UNPKG

taglib-wasm

Version:

TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps

22 lines (21 loc) 490 B
function hasFsShape(fs) { const candidate = fs; return typeof candidate?.statSync === "function" && typeof candidate?.readFileSync === "function"; } function getNodeFsSync() { const proc = globalThis.process; try { const fs = proc?.getBuiltinModule?.("node:fs"); if (hasFsShape(fs)) return fs; } catch { } try { const fs = new Function("return require('node:fs')")(); if (hasFsShape(fs)) return fs; } catch { } return null; } export { getNodeFsSync };