@piuccio/json-to-file
v1.0.1
Published
Save a JS object to file and output its file size
Downloads
3
Readme
Save a JS object to file and output its file size
Usage
const save = require('@piuccio/json-to-file');
await save('filepath.json', {
myObject: '...',
});
It'll create a file called filepath.json
and console.log
the generated file size in human readable way
Options
save(filename, content, options)
The third optional argument is an options object containing
pretty: Boolean
defaults tofalse
, iftrue
the generated JSON file will have indentation of 2 spaces.cwd: String
defaults toundefined
, it set, all paths will be prefixed withcwd