0.1.1 • Published 6 years ago

@guntur/json-fs v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

json-fs

Travis CI node npm

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