Skip to content
super simple synchronous json storage
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
.gitignore
.npmignore
Readme.md
index.js
package.json

Readme.md

cubby

super simple synchronous json storage (there is also a mysql version)

this was originally created to provide a way to store data for a few command-line tools, and is not geared towards performance

installation

$ npm install cubby

usage

var Cubby = require('cubby'),
    cubby = new Cubby();

cubby.set('foo', 'bar');

console.log(cubby.get('foo'));

or

cubby.set({
    one: 'one',
    two: 'two',
    three: {
        nested: true
    }
});

console.log(cubby.get('one')); // returns one
console.log(cubby.getPath('three.nested')); // returns true

multiple files

by default creating a cubby will result in a cubby.json file, but you can change this by providing a file path

var cubbyOne = new Cubby({file: 'something-one.json'}),
    cubbyTwo = new Cubby({file: 'something-two.json'});

paths

cubby.setPath('one.two.three', true);
cubby.getPath('one.two.three');
cubby.getPath('one.two.three.four'); // returns undefined when value doesn't exist
Something went wrong with that request. Please try again.