Registry / database / rengandb

rengandb

JSON →
library1.0.7jsnpmunverified

RenganDB is a Node.js JSON/YAML database module with file-locking via proper-lockfile and live file watching via chokidar. Version 1.0.7 offers two engines: a fast native flat-key mode (default) and a deeply nested path mode using lodash. It supports JSON, YAML, and YML formats with auto-detection. The library is designed for small-scale projects needing simple persistent storage with basic concurrency protection. It is not suitable for high-throughput or distributed scenarios.

npm install rengandb
INSTALL
IMPORT
SIG · RENGANDB
R
rengandb
databasejavascriptv1.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Database
import Database from 'rengandb'
const Database = require('rengandb')
ESM-only; named exports are not available, only default export.
Database
import Database from 'rengandb'
import { Database } from 'rengandb'
Only default export exists. Named import will result in undefined.
Database.init
const db = await Database.init(...)
const db = new Database(...)
init() is a static async factory method; direct constructor is not exposed.

Demonstrates basic CRUD operations with default and lodash engines, including init, set, get, has, delete, and fetchAll.

import Database from 'rengandb'; async function main() { // Initialize JSON database const db = await Database.init('database.json'); // Set a value await db.set('username', 'Rengan'); // Get a value console.log(db.get('username')); // 'Rengan' // Use lodash engine for deep paths const dbDeep = await Database.init('deep.json', { useLodash: true }); await dbDeep.set(['user', 'age'], 25); await dbDeep.set('user.role', 'admin'); console.log(dbDeep.fetchAll()); // { user: { age: 25, role: 'admin' } } // Delete a key await db.delete('username'); console.log(db.has('username')); // false } main().catch(console.error);
Debug
Known issues
breakingDo not toggle useLodash setting on an existing database file.
fix
Always decide on the engine before saving data and stick with it. If you must switch, manually transform the data file.
affects: >=1.0.0
gotchaArrays or dot-notation keys in native mode (useLodash: false) produce flat string keys, not nested objects.
fix
If you need nested objects, enable useLodash: true. Or use unique flat keys without dots or arrays.
affects: >=1.0.0
gotchaThe library is ESM-only and cannot be loaded via require() normally.
fix
Use import syntax or configure your project for ESM (type: 'module' in package.json).
affects: >=1.0.0
deprecatedMethod db.fetch(key) is an alias for db.get(key) and may be removed in future versions.
fix
Use db.get(key) consistently.
affects: >=1.0.0 <2.0.0
Errors
Common errors & fixes
TypeError: Database.init is not a function
Incorrect import: using named import instead of default import.
fix
Use: import Database from 'rengandb';
ENOENT: no such file or directory, open 'database.json'
The directory for the database file does not exist.
fix
Ensure the directory exists before calling Database.init(). Use mkdirp or manually create the folder.
Error: Unexpected token } in JSON
Manual edits to the JSON file introduced syntax errors.
fix
Validate the JSON file with a linter or undo manual changes. The library does not auto-repair corrupt JSON.
Error: Cannot find module 'proper-lockfile'
Missing peer dependency proper-lockfile.
fix
Run: npm install rengandb proper-lockfile chokidar. For lodash engine, also install lodash.
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies
proper-lockfilerequiredFile locking for concurrent write safety
chokidarrequiredFile watching for live automatic sync
lodashoptionalOptional deep object manipulation engine
Agent activity
8 hits · last 30 days
node
6
Meta
1
Resources
rengandb — npm install rengandb · libregistry