Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript
300 B
Raw Blame
import { fileURLToPath } from 'url';

export function pathify(path) {
  if (path.startsWith('file://')) {
    path = fileURLToPath(path);
  }
  return path;
}

export function instantiateEmscriptenWasm(factory, path) {
  return factory({
    locateFile() {
      return pathify(path);
    },
  });
}