{"_id":"@avmc/bun-extractor","_rev":"2-b96bcf68784ad42618b19f6ef261fb16","name":"@avmc/bun-extractor","dist-tags":{"latest":"0.5.1"},"versions":{"0.5.0":{"name":"@avmc/bun-extractor","version":"0.5.0","license":"MIT","_id":"@avmc/bun-extractor@0.5.0","maintainers":[{"name":"hwittenborn-gov","email":"hunter.k.wittenborn.ctr@army.mil"},{"name":"hwittenborn","email":"hunter@hunterwittenborn.com"}],"bin":{"bun-extractor":"dist/cli.js"},"dist":{"shasum":"7c80994e2eb55263e5762af25db3a097fd4a38aa","tarball":"https://registry.npmjs.org/@avmc/bun-extractor/-/bun-extractor-0.5.0.tgz","fileCount":6,"integrity":"sha512-FsMVbYQAzWci4Izd1b17ai8k0VoJ1j2Bcxl7/favsZlEGN40+ZL8OD29FmLndvbtovdZnjBDu7WTR+xsZe1Hzg==","signatures":[{"sig":"MEUCIQC8N6shMeM1/Zl+b6jfM2WJJFVU4iQdsUcdGGhUMpNgywIgZCc0CYF8WtLawrY1D/e2TmBSBY6ylUFm55WikzbvNWE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12713},"type":"module","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"157c59e59d163e5562e5432224a97bb37d33f36b","scripts":{"build":"bun run scripts/build.ts","build:all":"bun run scripts/build.ts --all","build:lib":"bun run scripts/build.ts --lib"},"_npmUser":{"name":"hwittenborn","email":"hunter@hunterwittenborn.com"},"_npmVersion":"11.13.0","description":"Extract embedded JS modules from Bun standalone (--compile) binaries","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/bun-extractor_0.5.0_1778621454659_0.059485633591360276","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@avmc/bun-extractor","version":"0.5.1","description":"Extract embedded JS modules from Bun standalone (--compile) binaries","type":"module","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"bin":{"bun-extractor":"dist/cli.js"},"scripts":{"build":"bun run scripts/build.ts","build:all":"bun run scripts/build.ts --all","build:lib":"bun run scripts/build.ts --lib"},"engines":{"node":">=18"},"license":"MIT","devDependencies":{"@types/node":"^25.6.0"},"gitHead":"157c59e59d163e5562e5432224a97bb37d33f36b","_id":"@avmc/bun-extractor@0.5.1","_nodeVersion":"22.22.2","_npmVersion":"11.13.0","dist":{"integrity":"sha512-27Ry6AShXQbIWYFDtxLtaPMivW+mDreIYO/OfFYoTUqDRt5Nc/sH5OsnOd3nwSvZ/yBwwEBdO3MVf6TFGjMb6w==","shasum":"a470c67e8f154a8cad0e1d8c0eac14a1024984c0","tarball":"https://registry.npmjs.org/@avmc/bun-extractor/-/bun-extractor-0.5.1.tgz","fileCount":6,"unpackedSize":12715,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDgCuhpBq9xywQW46Xfag5mWKVxrGiLVkQKws87e6dpMwIgVfrxDrUBP1LehHB1SNpD+z8/sqsBDKJTAyZLtXr2YoE="}]},"_npmUser":{"name":"hwittenborn","email":"hunter@hunterwittenborn.com"},"directories":{},"maintainers":[{"name":"hwittenborn-gov","email":"hunter.k.wittenborn.ctr@army.mil"},{"name":"hwittenborn","email":"hunter@hunterwittenborn.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bun-extractor_0.5.1_1778621618993_0.44038063528655247"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-12T21:30:54.488Z","modified":"2026-05-12T21:33:39.301Z","0.5.0":"2026-05-12T21:30:54.826Z","0.5.1":"2026-05-12T21:33:39.137Z"},"license":"MIT","description":"Extract embedded JS modules from Bun standalone (--compile) binaries","maintainers":[{"name":"hwittenborn-gov","email":"hunter.k.wittenborn.ctr@army.mil"},{"name":"hwittenborn","email":"hunter@hunterwittenborn.com"}],"readme":"# bun-extractor\n\nExtract embedded JS modules from [Bun standalone](https://bun.sh/docs/bundler/executables) (`bun build --compile`) binaries.\n\nParses the binary's embedded payload, recovers all bundled modules, and rewrites internal `/$bunfs/` imports to relative paths so the extracted source is immediately runnable.\n\n## Install\n\n```sh\nnpm install @avmc/bun-extractor\n```\n\n## CLI\n\n```sh\n# List embedded modules\nnpx @avmc/bun-extractor ./my-app --list\n\n# Extract all modules to a directory\nnpx @avmc/bun-extractor ./my-app -o ./extracted\n```\n\n### Options\n\n| Flag | Description |\n|---|---|\n| `-l, --list` | List embedded modules without extracting |\n| `-o, --out <dir>` | Extract to a specific directory (default: cwd) |\n| `-h, --help` | Show help |\n\n## API\n\n```ts\nimport { openBinary } from \"@avmc/bun-extractor\";\nimport { readFileSync } from \"fs\";\n\nconst bin = openBinary(readFileSync(\"./my-app\"));\n\nconsole.log(bin.entryPoint.path);   // e.g. \"src/index.js\"\nconsole.log(bin.entryPoint.source); // JS with /$bunfs/ imports rewritten\n\nfor (const mod of bin.modules) {\n  console.log(mod.path, mod.size, mod.loader);\n}\n```\n\n### `openBinary(buffer: Buffer): BunBinary`\n\nParse a Bun standalone binary and return a `BunBinary` instance.\n\n### `BunBinary`\n\n- `modules: Module[]` — all embedded modules\n- `entryPoint: Module` — the binary's entry point module\n\n### `Module`\n\n- `name: string` — full virtual path (e.g. `/$bunfs/root/src/foo.js`)\n- `path: string` — cleaned path with virtual prefix stripped (e.g. `src/foo.js`)\n- `loader: string` — `js`, `ts`, `jsx`, `tsx`, `json`, `css`, `file`, etc.\n- `format: string` — `esm`, `cjs`, or `none`\n- `isEntry: boolean`\n- `hasSourcemap: boolean`\n- `hasBytecode: boolean`\n- `contents: Buffer` — raw bytes (zero-copy view into the binary buffer)\n- `source: string` — decoded JS/TS source with `/$bunfs/` imports rewritten to relative paths\n- `size: number`\n\n## Supported platforms\n\nWorks on Linux, macOS, and Windows binaries. Handles both `/$bunfs/` (Linux/macOS) and `B:\\~BUN\\` (Windows) virtual path formats.\n\nRequires Node.js >= 18.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}