0.1.1 • Published 7 years ago
@guntur/json-fs v0.1.1
json-fs
Read and write json file
Install
$ npm install @guntur/json-fsUsage
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
nullfor not using indentation.
License
MIT © Guntur Poetra