JavaScript

USearch for JavaScript

npm install usearch 3.0.0-rc.1 · 4c3e5023

It needs Node.js 22 or newer, ships prebuilt addons for Linux and macOS on x86-64 and Arm64 and for Windows on x86-64, and loads as CommonJS or an ES module, with TypeScript declarations. It exposes dense indexes; sequence, matrix and geospatial indexes follow as the C library ships them.

Topics

InstallationThe addon links against the C interface as a static archive, so usearch.node carries the engine inside it rather than beside it.
Quickstart
Executors44A call that names no executor runs on the calling thread, single-threaded on RAM and on the handle's device and default stream on VRAM, and spawns nothing behind the caller's back.
Keys9A key is sixteen opaque bytes, most significant first, and that is the only form a full 128-bit key survives.
Inputs and Outputs29Every output whose length only the call knows, such as matches, rows, products, monoliths and cursor or stream batches, lands in an Arena you pass, and the verb answers a view over it without copying.
Metrics37A dense index holds equidimensional embeddings.
Residency1An executor and an index are each built through the residency they drive, so a direct new usearch.Executor() or new usearch.DenseIndex() throws and names the factories instead.
Serialization11Persist and restore an index through the filesystem, or through memory when checkpoints live in an object store.
Filtered Search
Refinement3
Linear Algebra12multiply is the sparse sibling of search: every left row emits one pair per column the walk scored rather than one ranked match, so the scores are unnormalized logits and the index must hold the Inner kind.
Retrieval and Streaming37
Introspection5health audits from the search landmarks, and entries it misses stay unfound until a refine re-links them; its sweeps counts the levels the audit took to converge.
Errors2Failures throw an Error whose code is a usearch.Status, one member per status of the C interface, spelled as its canonical name such as 'shape-mismatch'.
Platform NotesA JavaScript callback runs only on the thread owning the JavaScript context, and an executor's threads never are.