A file system data store using SHA1 keys
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

shade

A file system data store using SHA1 keys

Build Status

example

save

var shade = require('shade');

shade('/tmp/mydata', function (err, db) {
    db.save('ChBZvReWjm5YcTXTMK1GZausXZaCn', function (err, key) {
        console.log(key) // ecef0937
    })
});

load

var shade = require('shade');

shade('/tmp/mydata', function (err, db) {
    db.load('ecef0937', function (err, data) {
        if (!err) {
            console.log(data); // ChBZvReWjm5YcTXTMK1GZausXZaCn
        }
    })
});

methods

shade(dir, cb)

Creates a new data store rooted in the specified directory. cb(err, db) is called with either an error or a handle to the data store.

db.save(s, cb)

Saves a string s into the data store. cb(err, key) is called with either an error or the 8-character key that can be used to retrieve the data from the load method.

db.load(key, cb)

Loads a string from the data store using the specified key. cb(err, data) is called with either an error or the previously saved string.

install

Using npm:

npm install shade

license

MIT