Registry / database / machobot-database

machobot-database

JSON →
library0.1.14jsnpmunverified

A lightweight, embedded database designed specifically for the Macho framework. Version 0.1.14 is the latest stable release with minimal updates. It serves as a simple key-value store for Node.js applications, prioritizing ease of use over performance or scalability. Compared to alternatives like LevelDB or SQLite, it is tightly coupled to the Macho ecosystem and not recommended for standalone use.

npm install machobot-database
INSTALL
IMPORT
SIG · MACHOBOT-DATABASE
M
machobot-database
databasejavascriptv0.1.14
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 'machobot-database'
const Database = require('machobot-database')
ESM-only; no CommonJS support. Type definitions are not provided.
default import
import db from 'machobot-database'
const db = require('machobot-database').default
Default export is the Database constructor. Named import { Database } also works.
open
import { open } from 'machobot-database'
const { open } = require('machobot-database')
ESM-only; open is a named export.

Shows basic usage: creating a Database instance, setting and getting values, and using the open helper for simpler access.

import { Database } from 'machobot-database'; import { open } from 'machobot-database'; const db = new Database({ path: './mydb' }); await db.set('key', 'value'); const val = await db.get('key'); console.log(val); // 'value' await db.close(); // Using open helper const db2 = await open('./mydb2'); await db2.set('foo', 'bar'); const result = await db2.get('foo'); console.log(result); // 'bar' await db2.close();
Debug
Known issues
breakingThe constructor signature changed between 0.1.0 and 0.1.1: options object is now required.
fix
Pass an options object with at least 'path' property: new Database({ path: './db' })
affects: >=0.1.0 <0.1.1
breakingAll methods are async since 0.1.0; synchronous methods removed.
fix
Use await or .then() for all database operations.
affects: >=0.1.0
gotchaDatabase files are locked while open; concurrent access from multiple processes will fail silently.
fix
Ensure only one process accesses the database at a time, or use a client-server database.
affects: >=0.0.0
deprecatedThe `close()` method is deprecated; use `db.close()` synchronously (it returns void).
fix
Simply call db.close() without await.
affects: >=0.1.10
Errors
Common errors & fixes
TypeError: db.get is not a function
Trying to call get() on a closed database or using CommonJS require() which returns the module object incorrectly.
fix
Ensure you are using ESM imports and that the database is open before calling methods.
Error: Cannot find module 'machobot-database'
Package not installed or installed globally instead of locally.
fix
Run 'npm install machobot-database' in your project directory.
Upgrade
Version history
0.1.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
machobot-database — npm install machobot-database · libregistry