simple offline storage


Offline storage for key/value with an async api and optional key prefixing.

var kayv = require('kayv');
var db = kayv('prefix');
// set a value 
db.set('key', { foo: 'bar'}, function(err) {
    // value has been stored under <prefix>.<key> 
    // get it later with `get` 
    // db.get('key', ...) 

Similar to localStorage API except a callback fn is called when operations are complete. Callback functions follow "error first" style with the first argument being an Error instance or null if success.

Return a new Db instance to access key/values. The prefix is used to namespace all of the keys in this way allowing you to create separate "dbs".

Clear all values from the db.

Get the value for a given key. If there is no value previously set then value will be null. Lack of value is NOT an error.

Set the value for a given key. Value can be any JSON serializable type.

Remove a given key from the db.

Return the number of total keys.

Get the key at idx.