toiletdb

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

  • Owner: max-mapper/toiletdb
  • Platform:
  • License::
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

toiletdb :toilet:

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')

// open the db
await db.open()

// read data from data.json
var data = await db.read()
// read `key` inside data.json
var value = await db.read(key)

// sets `key` to `val` inside data.json
await db.write(key, val)

// deletes `key` key from data.json
await db.delete(key)

// deletes everything from data.json  
await db.flush()

// synchronous version
db.flushSync()

Custom FS


// pass the name and custom fs
var db = toilet({fs: customFs, name: './data.json'})

// write/read as normal

Main metrics

Overview
Name With Ownermax-mapper/toiletdb
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:
所有者活动
Created At2017-02-02 01:52:14
Pushed At2019-04-04 02:55:10
Last Commit At2019-04-03 19:54:53
Release Count8
Last Release Namev2.0.0 (Posted on 2019-04-03 19:54:53)
First Release Namev1.1.0 (Posted on 2017-02-01 18:23:02)
用户参与
Stargazers Count224
Watchers Count5
Fork Count19
Commits Count40
Has Issues Enabled
Issues Count6
Issue Open Count1
Pull Requests Count11
Pull Requests Open Count1
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private