TehShrike / toiletdb

flushes an object to a JSON file. lets you do simple CRUD with async safely with the backend being a flat JSON file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toiletdb

flushes an object to a JSON file. lets you do simple CRUD with async safely with the backend being a flat JSON file

uses require('last-one-wins') to ensure atomicity of CRUD actions

note: if you write Buffers they will be converted to hex strings

API

var toilet = require('toiletdb')
// or require the in-memory version if you want
var db = require('toiletdb/inmemory')

// pass the name of the json file to use
var db = toilet('./data.json')

db.read(function (err, data) {
  // data is from data.json
})

db.write(key, val, function (err) {
  // sets `key` to `val` inside data.json
})

db.delete(key, function (err) {
  // deletes `key` key from data.json
})

About

flushes an object to a JSON file. lets you do simple CRUD with async safely with the backend being a flat JSON file


Languages

Language:JavaScript 100.0%