JavaScript · Installation

Installation

6.0.0-rc.1 · 91a27bdd

Install the package from npm:

npm install stringzilla
import sz from "stringzilla";

The addon requires Node.js 22 or newer. Supported platforms get a prebuilt one from their @stringzilla/<platform>-<arch> package, and elsewhere the install compiles it through cmake-js, which needs CMake and a C compiler. A checkout builds it with npm run prebuild, which stages the addon under prebuilds/ where the loader finds it first.

§ Runtimes

The binding is a native Node-API addon, compiled from C against node_api.h. Node-API is a stable, runtime-agnostic ABI, so the same compiled .node addon runs beyond Node.js. It also loads on Bun and Deno through their Node-API compatibility layers, which implement the napi_* interface that this addon links against. No Bun- or Deno-specific build is required; the addon and its node-gyp-build-based loader are shared across all three runtimes.

Separately, StringZilla’s C/C++ core compiles to WebAssembly. Targeting wasm32-wasip1 with STRINGZILLA_MARCH set to v128 or v128relaxed enables the core’s STRINGZILLA_TARGET_V128 and STRINGZILLA_TARGET_V128RELAXED SIMD backends — the same v128 kernels the native addon uses. This is a capability of the C core, exercised by the WebAssembly test builds; the npm package itself ships the N-API native addon and does not bundle a prebuilt .wasm artifact.