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.

16 Zeilen
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. };