Utilities for map projections.
Ви не можете вибрати більше 25 тем
Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
|
- 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.');
- };
|