Utilities for map projections.
Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
|
- 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.');
- };
|