Utilities for map projections.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

16 righe
428 B

  1. import { PNG } from 'pngjs';
  2. import { readFile } from 'fs/promises';
  3. export const load = async (pngInput: string | Buffer | PNG) => {
  4. if (typeof pngInput === 'string') {
  5. const pngFile = await readFile(pngInput);
  6. return PNG.sync.read(pngFile);
  7. }
  8. if (typeof pngInput === 'object') {
  9. return pngInput instanceof PNG ? pngInput : PNG.sync.read(pngInput);
  10. }
  11. throw new TypeError('Invalid input argument.');
  12. };