promise-jsonfile
v1.1.2
Published
Read and write JSON file with Promise
Downloads
20
Readme
promise-jsonfile
Read and write JSON file with Promise.
This library is derived from node-jsonfile.
How to use
Typescript supported, check the demo.
Installation
npm install promise-jsonfile --save
Usage
import jsonfile from 'promise-jsonfile';
// read file
jsonfile
.read('./your/file/path.json')
.then(jsonData => {
// do something
})
.catch(err => {
throw err;
});
// write file
jsonfile
.write('./your/output/path.json', {
your: 'json',
data: 'here'
})
.then(() => {
// do something
})
.cathc(err => {
throw err;
});