INNER CODE UNIT · JavaScript

resolveLibraryPath

Barre/ZeroFS · zerofs/zerofs-ffi/bindings/typescript/packaging/index.js:58

async function resolveLibraryPath() {
  const target = platformTarget();
  const pkg = platformPackageFor(target);
  if (pkg == null) {
    throw new Error(
      `zerofs-client: unsupported platform target ${JSON.stringify(target)} ` +
        `(${process.platform}/${process.arch}). Supported: linux-x64-gnu, ` +
        `linux-arm64-gnu, darwin-x64, darwin-arm64.`,
    );
  }
  try {
    // The platform package is an ESM module exporting `libraryPath`; import it
    // (works regardless of the host's CJS/ESM interop version, unlike require).
    const { libraryPath } = await import(pkg);
    if (typeof libraryPath !== "string") {
      throw new Error(`package ${pkg} did not export a string \`libraryPath\``);
    }
    return libraryPath;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…