Build Output
Default output location
Section titled “Default output location”By default pure build writes the downloaded binary to the current directory,
named after the entry file without its extension:
| Entry file | Default output |
|---|---|
| server.ts | ./server |
| src/main.ts | ./main |
| cli/index.js | ./index |
Pass -o/--out to choose an exact path:
pure build src/main.ts --out dist/myappThe binary is written with mode 0755, so it’s immediately executable:
./dist/myappWhen the output path already exists
Section titled “When the output path already exists”If a file already exists at the target path (the default -o or an explicit
one), pure doesn’t overwrite it — it appends a " (n)" suffix before the
extension, the same convention Windows Explorer uses for a pasted duplicate
file: hello → hello (1) → hello (2), and so on. The final message tells
you which path it actually wrote to:
Wrote ./hello (1) (3 work units) (./hello already existed)Pass -f/--force to overwrite the target path instead, for scripts/CI that
want the same fixed path every run:
pure build src/main.ts --out dist/myapp --forcePlatform matrix
Section titled “Platform matrix”Builds run in the cloud, so the machine you run pure build from doesn’t determine the output by itself — pass --platform to choose, or let it default to your own machine’s OS and architecture. Linux (x86_64 or arm64) is the default and most battle-tested target; macOS output Experimental is available too. Windows isn’t available yet.
By default, a Linux binary is a fully static musl build with no runtime dependency on the host’s C library — it runs unmodified on Alpine, inside a FROM scratch container, or on any Linux host. Pass --libc glibc if you need a dynamically-linked glibc binary instead. See Language → OS support for the full platform matrix and macOS caveats.
Binary size
Section titled “Binary size”Release binaries include the Pure runtime. Typical sizes:
| Workload | Approximate size | |---|---| | Hello world | ~2 MB | | HTTP server | ~4–6 MB | | Complex CLI with deps | ~10–20 MB |
Every build is an optimised release build and is already stripped of debug symbols automatically — no extra step needed.
Cold start
Section titled “Cold start”Pure binaries start fast because there is no module resolution, cache warm-up, or JIT compilation at startup. Typical cold start times:
| Workload | Approximate cold start | |---|---| | Hello world | < 5 ms | | HTTP server (first request) | < 20 ms | | CLI with heavy initialization | 30–100 ms |
These are wall-clock measurements on commodity hardware. Actual times depend on binary size, filesystem speed, and system load.
Signals
Section titled “Signals”Standard POSIX signals work: SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2. Register handlers via process.on('SIGTERM', ...) as you would in Node.
Node addon output
Section titled “Node addon output”Passing --target node-addon produces a Node.js native addon instead of a
standalone executable. The downloaded artifact (written to --out) is an
installable npm tarball that you install like any other package:
pure build src/index.ts --target node-addon --out ./mypkg.tgznpm install ./mypkg.tgzThe tarball contains the compiled .node addon, a small index.js shim, the
preserved TypeScript types, and a package.json whose name and version are
inherited from your project. --target node-addon therefore requires a
package.json at or above your entry file.
Once installed, consumers require() it as usual:
const mypkg = require('mypkg');