- Category
- Developer Tools
- Rank
- No. 1028Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- nodejs
- GitHub
- 248 stars
- Latest release
- v1.0.0-alpha.6
- Date
About
Inject read-only resources into Mach-O, PE, and ELF executables and access them at runtime — used by Node.js single-executable apps.
What it does
Postject modifies an already-built executable, placing supplied bytes into the format’s native resource structure. Programs compiled with its C header can detect that payload and locate it in memory while running.
Why it's ranked here
Postject solves a narrow systems problem with unusually broad executable coverage. Its command line and JavaScript library share one implementation, while runtime lookup follows each operating system’s standard binary conventions. The format-specific edge cases keep it from being a universal packaging layer.
What's good
It supports both scripted and command-line workflows, rejects unknown executable formats, and prevents accidental replacement unless overwrite is requested. Mach-O fat binaries receive the resource in every contained binary. Tests exercise injection through both interfaces and then run the modified program to verify retrieval.
Tradeoffs
Injection rewrites the target file in place and requires read and write access. The sentinel must occur exactly once in the binary. Mach-O injection removes an existing code signature, so the executable needs signing again. PE injection fails when the binary has no resource tree.
How to use it well
Use Postject in build or release automation that must attach a fixed payload after linking, especially across Windows, macOS, and Linux. Compile its lookup header into the consumer, keep resource names consistent, and sign Mach-O outputs afterward. It does not replace mutable storage, network delivery, or code-signing tooling.
Technical notes+
package.json exposes an npm CLI and CommonJS library and requires Node.js 14 or newer. src/api.js validates a Buffer payload and target permissions, detects the executable type through the generated module, dispatches format-specific injection, flips a unique sentinel fuse, and writes the rebuilt bytes back. src/postject.cpp binds LIEF-based C++ routines through Emscripten; it stores ELF notes, Mach-O sections in a read-only segment, and PE raw-data resources. postject-api.h supplies platform-specific runtime discovery. scripts/build.mjs compiles with CMake, Ninja, and Emscripten, then bundles the JavaScript API. test/cli.mjs covers both public interfaces and executes modified test binaries.
Observed
- License
- MIT for Postject, with externally maintained LIEF covered by Apache License 2.0.
- Primary languages
- JavaScript and C++ with a C-compatible runtime header.
- Packaging
- Published as an npm package requiring Node.js 14 or newer; documented global installation is supported.
- Interfaces
- Command-line utility and CommonJS library.
- Executable formats
- Mach-O, PE, and ELF.
- Runtime platforms
- macOS, Windows, and Linux.
- Build requirements
- CMake, Ninja, and Emscripten.
- Test structure
- Repository includes command-line, library, C, and C++ tests.
Read from package.json, src/cli.js, src/api.js, src/postject.cpp, scripts/build.mjs, test/test.c, test/cli.mjs, test/test.cpp, LICENSE, .npmignore, CODEOWNERS, DEPENDENCIES, CMakeLists.txt, postject-api.h, README.markdown.
What it can do
Inject read-only resources into Mach-O executables
Mach-O executable file and resource data → Modified Mach-O executable with embedded resources
Inject read-only resources into PE executables
PE executable file and resource data → Modified PE executable with embedded resources
Inject read-only resources into ELF executables
ELF executable file and resource data → Modified ELF executable with embedded resources
Access injected resources at runtime
Executable with injected resources → Retrieved resource data during program execution
Create Node.js single-executable applications
Node.js application code and dependencies → Standalone executable file containing Node.js app
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.
