0.1.1 • Published 7 years ago

@nodeframe/persistent-data v0.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Build Status

Persistent Data

Imagine what the easiest way to use persistent data in a project it becomes to be this library, Persistent Data doesn't use a database. Instead, BSON are stored in the file system there is no overhead and dependency, you can use anywhere and it will stored persistent file in your own project or what the path you wish without any painless

Installation

npm install @nodeframe/persistent-data

then the code you can do

// es module
import Data from '@nodeframe/persistent-data'
// or 
var Data = require('@nodeframe/persistent-data')

Usage

const data = new Data({},PATH) // the initial value is empty object and it will store bson file to PATH, 

data.save({name:"John Doe"})
data.load() // get {name:"John Doe"}

data.merge({age:22})
data.load() // get {name:"John Doe",age:22}

data.save() // this is reset the data to default
data.remove() // remove bson persistent file