mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
Jest now uses SWC to transpile the Node SDK tests, with the same ES2022 target and legacy decorator semantics as the SDK. The Node and Arrow compatibility jobs run the existing test TypeScript project through `tsc --noEmit` after building the SDK. Contributors can run that check with `pnpm run typecheck:tests`. Closes #2234. Measured on Windows x64 with Node 22.23.4, Jest 29.7, the default native features and one Jest process (`--runInBand --silent`). Both runs used the same 0.42.0-beta.26 Windows native binary. Times below are wall-clock seconds. | Workload | ts-jest | SWC | | --- | ---: | ---: | | Six suites, empty Jest cache (median of three) | 8.31 | 4.22 | | Same six suites, populated cache (median of three) | 4.45 | 3.52 | | Full default suite, empty Jest cache (one run each) | 50.10 | 38.55 | The six suites were `arrow`, `expr`, `materialized_view`, `package`, `registry` and `sanitize`. Each pair started with a fresh Jest cache directory and immediately reused it on the second run. The separate test type check took 3.39 s, bringing the full SWC run plus type checking to 41.94 s on this machine. Both full runs passed the same 1,882 tests with 28 skipped. The SDK TypeScript build, test type check, Biome checks and TypeDoc build also passed. --------- Co-authored-by: lipeih <lipeihan@eazytec.com>
LanceDB JavaScript SDK
A JavaScript library for LanceDB.
Installation
npm install @lancedb/lancedb
This will download the appropriate native library for your platform. We currently support:
- Linux (x86_64 and aarch64 on glibc and musl)
- macOS (Apple silicon / arm64)
- Windows (x86_64 and aarch64)
Usage
Basic Example
import * as lancedb from "@lancedb/lancedb";
const db = await lancedb.connect("data/sample-lancedb");
const table = await db.createTable("my_table", [
{ id: 1, vector: [0.1, 1.0], item: "foo", price: 10.0 },
{ id: 2, vector: [3.9, 0.5], item: "bar", price: 20.0 },
]);
const results = await table.vectorSearch([0.1, 0.3]).limit(20).toArray();
console.log(results);
The quickstart contains more complete examples.
Development
See CONTRIBUTING.md for information on how to contribute to LanceDB.