@piuccio/json-to-file
v1.0.1
Published
Save a JS object to file and output its file size
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: Booleandefaults tofalse, iftruethe generated JSON file will have indentation of 2 spaces.cwd: Stringdefaults toundefined, it set, all paths will be prefixed withcwd
