Files
pnpm/worker
Zoltan Kochan 32f2902cfb feat: native CAFS writer for agent client path
Adds @pnpm/agent.cafs-writer — a napi-rs crate that parses the binary
/v1/files payload and writes each file to the CAFS in parallel. Wired
into worker/src/start.ts as an optional native path; falls back to the
existing JS streaming parser if the addon is not built for the host.

Backends:
- rayon + std::fs::write with O_CREAT|O_EXCL (default, all platforms)
- tokio-uring on Linux (behind cfg(target_os = "linux"))

End-to-end on the test-alot workload (1300 packages, warm agent server):
  native   19.3s
  js       23.3s   (~17% slower)

Microbench (parse + write only, darwin-arm64):
  10000 × 1KB files  native 1.8s   vs   js 8.3s   (~4.5x)

Toggle: set PNPM_CAFS_WRITER_DISABLE_NATIVE=1 to force the JS fallback.
The native module is an optionalDependencies entry of @pnpm/worker and
of the pnpm package (so the bundled CLI can resolve it at runtime).
2026-04-17 00:52:50 +02:00
..
2026-04-16 01:18:55 +02:00

@pnpm/worker

A worker for extracting package tarballs to the store

npm version

Installation

pnpm add @pnpm/worker

License

MIT