toiletdb

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

  • 所有者: max-mapper/toiletdb
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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

主要指標

概覽
名稱與所有者max-mapper/toiletdb
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證
所有者活动
創建於2017-02-02 01:52:14
推送於2019-04-04 02:55:10
最后一次提交2019-04-03 19:54:53
發布數8
最新版本名稱v2.0.0 (發布於 2019-04-03 19:54:53)
第一版名稱v1.1.0 (發布於 2017-02-01 18:23:02)
用户参与
星數224
關注者數5
派生數19
提交數40
已啟用問題?
問題數6
打開的問題數1
拉請求數11
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?