Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    flightpublic

    flight

    A simple flat file database in node.js. Do not use this for production use.

    API

    var db = new Db("myfile.db");
    var obj = { name:"Alex", age:28 };
    

    Supported Operations:

    db.set(obj, onWriteToDisk) /* => returns objId, which can be used with get to get it back */
    db.get(objId, onResult)
    db.remove(objId, onWriteRemoveToDisk)
    db.find(filterFn, onResults)
    

    Callbacks:

    • onWriteToDisk and onResult have a signature of 2 parameters (err, result).
    • onWriteRemoveToDisk has a signature with 1 parameter (err).
    • onResults has a signature with 2 parameters (err, results) where results is a list of matching objects.

    Events:

    db.on("connected", onInitialReadFromDiskComplete)
    

    Options:

    You can pass { memory:true } as 2nd argument to the Db constructor and the database will be a pure in-memory one. This is useful for testing.

    db = new Db("people.db", { memory:true });
    

    install

    npm i flight

    Downloadslast 7 days

    6

    version

    0.0.2

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar