Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 671 Bytes

how2use.md

File metadata and controls

44 lines (26 loc) · 671 Bytes

Install

npm install json.filed

Load module

var jf = require( 'json.filed' );

Locate path to file

var jsonfile = jf.filed( '/path/to/jsonFile' );

Read

jsonfile
.read( ( json ) => { < your code > } )
.exec();

For example :

.read( ( json ) => { console.log( json.msg ) } )

Result :

$ node exampleOnHow2Use.js
hello world

Write

 jsonfile
 .write( <json object to write > )
 .exec();

For example :

 .write( { msg: 'good after noon' } )

Result :

$ cat data.json
{"msg":"good after noon"}

Too easy for you ? Proceed next ariticle 👍
Reference ...