npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

treeboot

v0.16.0

Published

Use the Treeboot CLI from Node.js and Electron applications

Readme

treeboot for Node.js

This package makes the Treeboot executable available to Node.js tools and Electron applications. For direct use in a project, install Treeboot with mise instead. See the Treeboot repository for the main installation instructions.

bun add treeboot
import { getBinaryPath, spawnTreeboot } from "treeboot";

console.log(getBinaryPath());
const child = spawnTreeboot(["status", "--json"], { stdio: "inherit" });

The package supports Node.js 22 and newer. It publishes ESM, CommonJS, and TypeScript declarations.

API

  • getBinaryPath() returns the absolute path to the packaged executable for the current platform and architecture.
  • spawnTreeboot(args?, options?) starts Treeboot and returns a Node.js ChildProcess.
  • spawnTreebootSync(args?, options?) runs Treeboot synchronously and returns SpawnSyncReturns<string | Buffer>.
  • TreebootSpawnOptions and TreebootSpawnSyncOptions match the corresponding Node.js spawn options without the shell field.

Both spawn functions pass arguments as separate strings and force shell: false.

Resolution and errors

The facade selects one exact-version optional dependency:

| Platform | Architecture | Package | | -------- | ------------ | --------------------------- | | macOS | ARM64 | @treeboot-rs/darwin-arm64 | | macOS | x64 | @treeboot-rs/darwin-x64 | | Linux | ARM64 | @treeboot-rs/linux-arm64 | | Linux | x64 | @treeboot-rs/linux-x64 | | Windows | ARM64 | @treeboot-rs/win32-arm64 | | Windows | x64 | @treeboot-rs/win32-x64 |

Resolution never downloads a binary and never falls back to an executable on PATH.

The package exports these errors:

  • TreebootBinaryError is the base class for packaged-binary resolution failures. Catch it to handle either public subclass.
  • UnsupportedPlatformError reports an unsupported platform and arch.
  • MissingPlatformPackageError reports the expected packageName, platform, and arch. Its inherited cause preserves the underlying package or binary resolution failure when one is available.

CLI

npx treeboot and bunx treeboot run the packaged executable:

npx treeboot --version
bunx treeboot --version

The shim resolves the same platform package as the API, inherits standard input, output, and error, and forwards SIGINT and SIGTERM. It exits with the child's exit status, or with 128 + signal when the child exits due to a signal.

Electron

Call Treeboot from Electron's main process, a utility process with Node.js access, or an application backend. Renderer processes are not supported.

The selected @treeboot-rs/* package must remain in the packaged application. Its bin/ directory must be unpacked from app.asar, because Node's child_process.spawn requires a real filesystem path. For example, configure your packager to unpack:

node_modules/@treeboot-rs/**/bin/**

The resolver uses an existing .asar.unpacked peer when it finds a resolved binary inside .asar. Cross-architecture and universal builds must explicitly install and retain the platform packages for every target architecture; host optional-dependency selection is not enough.

Bundlers must leave the platform package as a runtime dependency. If optional dependencies are disabled or pruned, getBinaryPath() throws MissingPlatformPackageError with the expected package name.

See Electron's ASAR archive documentation for the underlying executable restrictions.