json-file-enc

0.0.1 • Public • Published

json-file-enc

install

using npm

npm i json-file-enc --save

example

Data = require 'json-file-enc'
db = new Data './test.dat'
 
log /reading when noexists/
json = db.read()
log json
 
log /write/
db.write {
  name: 'John Smith'
  age: 30
  ctime: new Date().getTime()
}
 
log /reading again/
log db.read()
 
log /writing again/
json = db.read()
json.name = 'Dave Smith'
db.write json
 
log /reading last/
log db.read()
 
process.exit 0
 
###
/test/
/reading when noexists/
{}
/write/
/reading again/
{ name: 'John Smith', age: 30, ctime: 1457638376684 }
/writing again/
/reading last/
{ name: 'Dave Smith', age: 30, ctime: 1457638376684 }
###

Package Sidebar

Install

npm i json-file-enc

Weekly Downloads

3

Version

0.0.1

License

none

Last publish

Collaborators

  • taky