merd.db
v1.0.0
Published
File-based JSON, YAML, and BSON database module by merd.
Maintainers
Readme
merd.db
A lightweight file database module for Node.js, created by merd.
merd.db gives you three drivers with one API style:
- JsonDatabase
- YamlDatabase
- BsonDatabase
Installation
npm i merd.dbQuick Start
const { JsonDatabase, YamlDatabase, BsonDatabase } = require("merd.db");
const jsonDb = new JsonDatabase({ filePath: "./data/merd.json" });
const yamlDb = new YamlDatabase({ filePath: "./data/merd.yaml" });
const bsonDb = new BsonDatabase({ filePath: "./data/merd.bson" });
jsonDb.set("user.name", "merd");
jsonDb.add("user.coins", 5);
jsonDb.push("user.roles", "owner");
console.log(jsonDb.get("user.name"));
console.log(jsonDb.get("user.coins"));
console.log(jsonDb.get("user.roles"));API
All drivers support the same methods:
- get(key, fallback)
- fetch(key, fallback)
- set(key, value)
- has(key)
- delete(key)
- ensure(key, defaultValue)
- add(key, amount)
- subtract(key, amount)
- inc(key, amount)
- dec(key, amount)
- push(key, value)
- pull(key, value)
- all()
- object()
- type(key)
- save()
- reload()
- clear()
Driver Factory
const { createDatabase } = require("merd.db");
const db = createDatabase("yaml", {
filePath: "./data/app.yaml"
});Branding and Attribution
This package is authored and branded by merd.
- package author: merd
- copyright: Copyright (c) 2026 merd
- notice file included: NOTICE
- exposed signature: AUTHOR_SIGNATURE
Publish to npm
- Log in:
npm login- Verify package name availability:
npm view merd.db- Run tests:
npm test- Publish:
npm publish --access publicIf npm says the name is already taken, publish under a scope:
npm publish --access publicwith a scoped name like @merd/merd.db in package.json.
License
MIT License, copyright belongs to merd.
