This is simple, fast, small (12.5 KB), no dependencies, local disk, table-level Node.js JSON database, which we often use in large development workloads.
npm i -S @talaikis/json-db
All functions need baseDir
, where the database is stored. For example: join(__dirname, '.data')
.
import { create } from '@talaikis/json-db'
await create(baseDir, table, itemName, jsonData).catch((e) => ...)
import { read } from '@talaikis/json-db'
const jsonData = await read(baseDir, table, itemName).catch((e) => ...)
import { update } from '@talaikis/json-db'
await update(baseDir, table, itemName, newJsonData).catch((e) => ...)
import { destroy } from '@talaikis/json-db'
await destroy(baseDir, table, itemName).catch((e) => ...)
import { list } from '@talaikis/json-db'
await list(baseDir, table).catch((e) => ...)
import { destroyTable } from '@talaikis/json-db'
await destroyTable(baseDir, table).catch((e) => ...)
npm run test
MIT