@guntur/json-fs
v0.1.1
Published
Read and write json file
Downloads
8
Readme
json-fs
Read and write json file
Install
$ npm install @guntur/json-fs
Usage
const jsonFs = require('@guntur/json-fs');
jsonFs.writeFile('/path/to/json/file/foo.json', {
cake: '🍰'
});
const obj = jsonFs.readFile('/path/to/json/file/foo.json');
console.log(obj);
/*
{
"cake": "🍰"
}
*/
API
readFile(filepath: string
)
Returns an object
writeFile(filepath: string, data: object, indent?: any = '\t'
)
Write a file with object
data.
Note: Use
null
for not using indentation.
License
MIT © Guntur Poetra