Utilities for map projections.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- 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.');
- };
|