flat.js
v0.0.99
Published
Flat JSON data store for node.js
Readme
#Flat.js - Flat data store for node.
##Example Usage:
var flat = require("flat.js");
var db = flat("./template.json", {persist: true});
//TODO: write unit tests
info.log("Database doesn't seem to exist, making it.", "warning", info.getLineNumber(), __filename);
db.openAsync("utf8", function(e) {
this.createTable("Users");
//Create a field called "user1" in the table "Users", populate it with an object
this.createField("Users", "user1", {
name: "Geoff",
age: 69
});
//Overwrite the object stored at "user1" with a new one
this.set("Users", "user1", {
name: "Harry",
age: 100
});
//Need to set a specific property on a stored object? (TODO: modify set function to accomdate this)
//For now do this:
this.store[db.name]["Users"]["user1"].age = 20;
this.setModified(true);
this.delete("Users");
});
License
MIT