Asynchronous reading from a Constant Database (CDB)
A CDB is an associative array mapping strings to values using a hash lookup.
This is a rewrite of D. J. Bernstein's Constant Database program.
More information on CDB here: http://cr.yp.to/cdb.html
npm install node-cdblib
git clone github.com:jukebox42/node-cdblib.git cd node-cdblib npm install # to install deps
var CDB_Read = require'./../node-cdblib'CDB_Reader;var reader = filepath:CDB_FILE_LOCATIONcdbfindKEYconsole.logvalue;;;
CDB_Reader(opts, callback) - The CDB Reader object. returns a cdb object that has the find and find_all functions
find(key,callback,offset) - Finds the first instance of a key and returns the value in the callback. false if the key was not found.
key (string) - they key to look up the value for callback (function) - The callback function. will contain one return value(string). false if key was not found offset (int) - when dealing with CDB files with multiple of the same key tyou can use offset to traverse them. defaults to 0 (optional)
find_all(key, callback) - Finds all instances of a key and returns the array of values in the callback. false if they key was not found.
key (string) - they key to look up the value for callback (function) - The callback function. will contain one return value(array). false if key was not found.