Utilities for map projections.
Du kannst nicht mehr als 25 Themen auswählen
Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
|
- import { PNG } from 'pngjs';
- import { readFile } from 'fs/promises';
-
- export const load = async (pngInput: string | Buffer | PNG) => {
- if (typeof pngInput === 'string') {
- const pngFile = await readFile(pngInput);
- return PNG.sync.read(pngFile);
- }
-
- if (typeof pngInput === 'object') {
- return pngInput instanceof PNG ? pngInput : PNG.sync.read(pngInput);
- }
-
- throw new TypeError('Invalid input argument.');
- };
|