🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

jsonkv

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonkv

Single file write-once database that is valid JSON with efficient random access on bigger datasets

Source
npmnpm
Version
0.0.0
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

jsonkv

Single file write-once database that is valid JSON with efficient random access on bigger datasets

npm install jsonkv

(WIP)

Usage

const jsonkv = require('jsonkv')

// First create a database (all data will be stored in ./db.json as valid JSON)
const ws = jsonkv.createWriteStream('db.json')

// Write a ton of data to it
for (var i = 0; i < 10000; i++) {
  ws.write({
    key: i,
    value: `this is a value: ${i}`
  })
}

ws.end(function () {
  // our jsonkv is now fully written and cannot be updated again.
  // to query it make an instance
  const db = jsonkv('db.json')

  db.get(42, function (err, doc) {
    console.log(doc) // prints {key: 42, value: 'this is a value: 42'}
  })
})

License

MIT

FAQs

Package last updated on 29 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts