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

@ruvector/rvf-node

v0.2.3

Published

RuVector Format Node.js native bindings

Readme

@ruvector/rvf-node

Native Node.js bindings for the RuVector Format (RVF) vector database. Built with Rust via N-API for native speed with zero serialization overhead.

Install

npm install @ruvector/rvf-node

Features

  • Native Rust performance via N-API (napi-rs), no FFI marshaling
  • Single-file vector database — crash-safe, no WAL, append-only
  • k-NN search with HNSW progressive indexing (recall 0.70 → 0.95)
  • Metadata filtering — Eq, Ne, Lt, Gt, Range, In, And, Or, Not
  • Lineage tracking — DNA-style parent/child derivation chains
  • Kernel & eBPF embedding — embed compute alongside vector data
  • Segment inspection — enumerate all segments in the file
  • Cross-platform — Linux (x86_64, aarch64), macOS (x86_64, Apple Silicon), Windows (x86_64)

Quick Start

const { RvfDatabase } = require('@ruvector/rvf-node');

// Create a store
const db = RvfDatabase.create('vectors.rvf', {
  dimension: 384,
  metric: 'cosine',
});

// Insert vectors
const vectors = new Float32Array(384 * 2); // 2 vectors, 384 dims each
vectors.fill(0.1);
db.ingestBatch(vectors, [1, 2]);

// Query nearest neighbors
const query = new Float32Array(384);
query.fill(0.15);
const results = db.query(query, 5);
// [{ id: 1, distance: 0.002 }, { id: 2, distance: 0.002 }]

db.close();

API Reference

Store Lifecycle

// Create a new store
const db = RvfDatabase.create(path: string, options: RvfOptions);

// Open existing store (read-write, acquires writer lock)
const db = RvfDatabase.open(path: string);

// Open read-only (no lock, concurrent readers allowed)
const db = RvfDatabase.openReadonly(path: string);

// Close and flush
db.close();

RvfOptions:

| Field | Type | Default | Description | |-------|------|---------|-------------| | dimension | number | required | Vector dimensionality | | metric | string | "l2" | "l2", "cosine", or "inner_product" | | profile | number | 0 | Hardware profile: 0=Generic, 1=Core, 2=Hot, 3=Full | | signing | boolean | false | Enable segment signing | | m | number | 16 | HNSW M parameter (neighbor count) | | efConstruction | number | 200 | HNSW index build quality |

Ingest Vectors

const result = db.ingestBatch(
  vectors: Float32Array,  // flat array of n * dimension floats
  ids: number[],          // vector IDs
  metadata?: RvfMetadataEntry[]  // optional metadata per vector
);
// Returns: { accepted: number, rejected: number, epoch: number }

Metadata entry format:

{ fieldId: 0, valueType: 'string', value: 'category_a' }
{ fieldId: 1, valueType: 'f64',    value: '0.95' }
{ fieldId: 2, valueType: 'u64',    value: '42' }

Query

const results = db.query(
  vector: Float32Array,      // query vector
  k: number,                 // number of neighbors
  options?: RvfQueryOptions   // optional search parameters
);
// Returns: [{ id: number, distance: number }, ...]

RvfQueryOptions:

| Field | Type | Default | Description | |-------|------|---------|-------------| | efSearch | number | 100 | HNSW search quality (higher = better recall, slower) | | filter | string | — | Filter expression as JSON string | | timeoutMs | number | 0 | Query timeout in ms (0 = no timeout) |

Filter Expressions

Filters are passed as JSON strings. All leaf filters require fieldId, valueType, and value:

// Equality
db.query(vec, 10, {
  filter: '{"op":"eq","fieldId":0,"valueType":"string","value":"science"}'
});

// Range
db.query(vec, 10, {
  filter: '{"op":"range","fieldId":1,"valueType":"f64","low":"0.5","high":"1.0"}'
});

// In-set
db.query(vec, 10, {
  filter: '{"op":"in","fieldId":0,"valueType":"u64","values":["1","2","5"]}'
});

// Boolean combinations
db.query(vec, 10, {
  filter: JSON.stringify({
    op: 'and',
    children: [
      { op: 'eq', fieldId: 0, valueType: 'string', value: 'science' },
      { op: 'gt', fieldId: 1, valueType: 'f64', value: '0.8' }
    ]
  })
});

// Negation
db.query(vec, 10, {
  filter: '{"op":"not","child":{"op":"eq","fieldId":0,"valueType":"string","value":"spam"}}'
});

Supported operators: eq, ne, lt, le, gt, ge, in, range, and, or, not

Supported value types: u64, i64, f64, string, bool

Delete

// Delete by ID
const result = db.delete([1, 2, 3]);
// Returns: { deleted: number, epoch: number }

// Delete by filter
const result = db.deleteByFilter(
  '{"op":"gt","fieldId":1,"valueType":"f64","value":"0.9"}'
);

Compact

Reclaims space from deleted vectors:

const result = db.compact();
// Returns: { segmentsCompacted: number, bytesReclaimed: number, epoch: number }

Status

const status = db.status();
// {
//   totalVectors: number,
//   totalSegments: number,
//   fileSize: number,
//   currentEpoch: number,
//   profileId: number,
//   compactionState: 'idle' | 'running' | 'emergency',
//   deadSpaceRatio: number,
//   readOnly: boolean
// }

Lineage & Derivation

RVF tracks parent/child relationships with cryptographic hashes:

db.fileId();        // hex string — unique file identifier
db.parentId();      // hex string — parent's ID (zeros if root)
db.lineageDepth();  // 0 for root files

// Derive a child store (inherits dimensions and options)
const child = db.derive('/tmp/child.rvf');
child.lineageDepth(); // 1
child.parentId();     // matches parent's fileId()

Kernel & eBPF Embedding

Embed compute segments alongside vector data:

// Embed a Linux microkernel
db.embedKernel(
  1,                           // arch: 0=x86_64, 1=aarch64
  0,                           // kernel type
  0,                           // flags
  Buffer.from(kernelImage),    // kernel binary
  8080,                        // API port
  'console=ttyS0 quiet'       // kernel cmdline (optional)
);

// Extract kernel
const kernel = db.extractKernel();
if (kernel) {
  console.log(kernel.header);  // Buffer: 128-byte KernelHeader
  console.log(kernel.image);   // Buffer: kernel image bytes
}

// Embed an eBPF XDP program
db.embedEbpf(
  1,                          // program type (XDP distance)
  2,                          // attach type (XDP ingress)
  384,                        // max vector dimension
  Buffer.from(bytecode),      // BPF ELF object
  Buffer.from(btf)            // optional BTF section
);

// Extract eBPF
const ebpf = db.extractEbpf();
if (ebpf) {
  console.log(ebpf.header);   // Buffer: 64-byte EbpfHeader
  console.log(ebpf.payload);  // Buffer: bytecode + BTF
}

Segment Inspection

const segments = db.segments();
// [{ id: 1, offset: 0, payloadLength: 4096, segType: 'manifest' },
//  { id: 2, offset: 4160, payloadLength: 51200, segType: 'vec' },
//  { id: 3, offset: 55424, payloadLength: 12288, segType: 'index' }]

db.dimension(); // 384

Build from Source

# Prerequisites: Rust 1.87+, Node.js 18+
cd crates/rvf/rvf-node
npm install
npm run build

Related Packages

| Package | Description | |---------|-------------| | @ruvector/rvf | Unified TypeScript SDK | | @ruvector/rvf-wasm | Browser WASM package | | @ruvector/rvf-mcp-server | MCP server for AI agents | | rvf-runtime | Rust runtime (powers this package) |

License

MIT OR Apache-2.0