kajtek

0.0.2 • Public • Published

NPM version Build Status Dependency Status Dev Dependency Status

kajtek

Basic node bindings for TinyCDB.

  • It does not support any encoding (works with buffers).
  • It allows for fast insertion and lookup through putMany and getMany

Install

$ npm install --save kajtek

Usage

var Kajtek = require('kajtek');
 
let db = new Kajtek('/path/to/my/db.dat');
 
// no encoding/decoding - kajtek works with Buffers
let keys = [2, 3, 4].map(x => Buffer.from([x]));
 
// keys and values have to be Arrays of Buffer's
db.putMany(keys, values, function(err) {
  // for each key in an keys set corresponding value from values
});
 
 
// keys and values have to be Arrays of Buffer's
db.getMany(keys, function(err, values, missing) {
  if (err) {
    // something went wrong
  }
  if (missing) {
    // some of the keys were not in DB
    // missing has indexes in the keys array, so to print the keys
    console.log('Missing keys:', missing.map(i => keys[i]));
  }
  // empty Buffer is returned for each missing key
});
 

License

MIT © Damian Krzeminski

Readme

Keywords

Package Sidebar

Install

npm i kajtek

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

68.3 kB

Total Files

31

Last publish

Collaborators

  • pirxpilot