0.0.2 • Published 5 years ago

kajtek v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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