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

meadow-connection-rocksdb

v0.0.2

Published

Meadow RocksDB Connection Provider

Readme

Meadow Connection RocksDB

A RocksDB embedded database connection provider for the Meadow ORM. Wraps the rocksdb LevelDOWN binding as a Fable service, providing high-throughput key-value storage with prefix-based iteration, atomic batch writes, and automatic database creation.

License: MIT


Features

  • Embedded Key-Value Store -- No daemon, no Docker, no server process -- just a folder path and you have a high-performance database backed by Facebook's RocksDB engine
  • LSM-Tree Architecture -- Write-optimized storage with log-structured merge trees; excellent for write-heavy workloads with consistent read performance
  • Prefix Iteration -- Scan all records sharing a key prefix using RocksDB's sorted key iteration with gte/lt range boundaries
  • Atomic Batch Writes -- Group multiple put/delete operations into a single atomic batch for consistency and performance
  • Fable Service Provider -- Registers with a Fable instance for dependency injection, logging, and configuration
  • Auto-Create Database -- Opens with createIfMissing: true so the database folder is created automatically on first connect
  • Direct Database Access -- Exposes the underlying RocksDB instance via db getter for native put/get/del/batch/iterator operations

Installation

npm install meadow-connection-rocksdb

The rocksdb dependency compiles a native addon at install time -- a C++ compiler toolchain must be available on the host.

Quick Start

const libFable = require('fable');
const MeadowConnectionRocksDB = require('meadow-connection-rocksdb');

let fable = new libFable(
{
	RocksDB:
	{
		RocksDBFolder: './data/myapp-rocksdb'
	}
});

fable.serviceManager.addServiceType('MeadowRocksDBProvider', MeadowConnectionRocksDB);
fable.serviceManager.instantiateServiceProvider('MeadowRocksDBProvider');

fable.MeadowRocksDBProvider.connectAsync((pError) =>
{
	if (pError)
	{
		console.error('Connection failed:', pError);
		return;
	}

	let tmpDB = fable.MeadowRocksDBProvider.db;

	// Write a value
	tmpDB.put('user:1', JSON.stringify({ name: 'Alice', age: 30 }), (pPutError) =>
	{
		// Read it back
		tmpDB.get('user:1', (pGetError, pValue) =>
		{
			let tmpUser = JSON.parse(pValue.toString());
			console.log(tmpUser.name);  // => 'Alice'
		});
	});
});

Configuration

The RocksDB folder path can be provided through Fable settings or the service provider options:

Via Fable Settings

let fable = new libFable(
{
	RocksDB:
	{
		RocksDBFolder: './data/app-rocksdb'
	}
});

Via Provider Options

let connection = fable.instantiateServiceProvider('MeadowRocksDBProvider',
{
	RocksDBFolder: './data/app-rocksdb'
}, MeadowConnectionRocksDB);

| Setting | Type | Required | Description | |---------|------|----------|-------------| | RocksDBFolder | string | Yes | Path to the RocksDB database folder. Created automatically if it does not exist. |

API

connectAsync(fCallback)

Open the RocksDB database at the configured folder path.

| Parameter | Type | Description | |-----------|------|-------------| | fCallback | Function | Callback receiving (error, database) |

connect()

Synchronous convenience wrapper for connectAsync (no callback, logs a warning).

closeAsync(fCallback)

Close the RocksDB database and release all resources.

| Parameter | Type | Description | |-----------|------|-------------| | fCallback | Function | Callback receiving (error) |

db (getter)

Returns the underlying RocksDB database instance for direct key-value operations. Returns false before connectAsync() is called.

connected (property)

Boolean indicating whether the database connection is open.

RocksDB Operations

After connecting, use the db getter to access the RocksDB instance:

let tmpDB = fable.MeadowRocksDBProvider.db;

// Put
tmpDB.put('key', 'value', (pError) => { /* ... */ });

// Get
tmpDB.get('key', (pError, pValue) => { console.log(pValue.toString()); });

// Delete
tmpDB.del('key', (pError) => { /* ... */ });

// Atomic Batch
tmpDB.batch([
	{ type: 'put', key: 'k1', value: 'v1' },
	{ type: 'put', key: 'k2', value: 'v2' },
	{ type: 'del', key: 'k3' }
], (pError) => { /* all operations applied atomically */ });

// Prefix Iteration
let tmpIterator = tmpDB.iterator({ gte: 'user:', lt: 'user:\uffff' });
// Iterate through all keys starting with 'user:'

Part of the Retold Framework

Meadow Connection RocksDB is a database connector for the Meadow data access layer:

Testing

Run the test suite:

npm test

Run with coverage:

npm run coverage

Related Packages

License

MIT

Contributing

Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the Retold Contributing Guide.