fst

fstore

fstore ======

Showing:

Popularity

Downloads/wk

5

Maintenance

No Maintenance Data Available

Package

Dependencies

0

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

fstore

key-value JSON based synchronous store built upon fs folders and files.

usage:

unique, put, unput, check, read to manipulate the identity, $set, $unset, $inc to issue the update

var FStore = require('fstore');
var store = new FStore('./test/s0');

var c = store.collection("c1");

console.log("Existing:", c.all_contents());

c.unique("A");
c.put("A", 1);
c.unput("B");

c.update("C", {$inc: {X: 1}, $set: {Y: 2}});
c.put("B", 2);
console.log("read D", c.read("D"));

console.log("later:", c.all_contents());

with the ensuring selector mechanism in mind, you could totally update or unput some key slot without put or unique it first, the FStore.prototype.collection(name) method is also an ensuring selector.

highlights

  • using folder structure to totally represent the storage
(-folder_path->) Store 
                        (-collection_name->) Collection
                                                        (-record_key->) records 
                                                                                (JSON)

thus ready to be human-readable and human-modifiable

  • a key-value persistent layer for your NodeJs apps, ready to be taken away with the code itself

  • a NoSQL DB without setting up a service

  • fully synchronous, suited for smaller applications or of sporadic nature

  • arbitary JSON as the record

  • suited for all Linux, Mac, Windows, Rasperry Pi, etc. with NodeJs fs facility provided.

APIS for FStore

FStore.prototype.collection(name)
  • the ONLY normal way to read/create( that is "ensure") a collection of the name name in a given store
FStore.prototype.all_collections()
  • get all Collections, grouped by name, this is another way
FStore.prototype.all_contents()
  • get all contents of all collections, grouped by collection name
  • i.e. grab a massive JS object of everything in the store
FStore.prototype.destroy()
  • removal of the whole store, including the corresponding folder
FStore.prototype.clear()
  • make the store like a new one (containing no collection)
  • leaving the folder untact

APIS for FCollection

FCollection.prototype.destroy()
  • total removal of the collection
FCollection.prototype.clear()
  • make the collection contain nothing
FCollection.prototype.all_keys()
  • get all keys of the collection
FCollection.prototype.all_contents()
  • get all contents of the collection, grouped by keys
  • i.e. grab a massive JS object of everything in the collection
FCollection.prototype.unique(key)
  • create a slot for the key, defaulting the content to be null; or if the key already exists, read the slot content
FCollection.prototype.put(key, content)
  • put(refresh) the content at the key slot
FCollection.prototype.unput(key)
  • unput(delete) the slot at the key
FCollection.prototype.check(key)
  • check the key slot exists, without reading
FCollection.prototype.read(key)
  • read the content at key slot
  • if the slot does not exist, return undefined;
FCollection.prototype.update(key, update_ball)
  • update at the key slot using update_ball
update_ball: {
  $set: {a: 12, c: [123, 232], d: {x: 1}},
  $unset: {b: 1},
  $inc: {e: 1}
}

Future

  1. Fan-out to increase efficiency in large number of records or collections, due to FS constraints
  2. zipped export, import and snapshots for easy transferation, archival and backup
  3. storage monitoring
  4. basic level runtime indexing on record JSON's keys and values
  5. able to hookup a message queue to increase throughput

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial