This package has been deprecated

Author message:

Use jsonfile instead

writeson

1.0.1 • Public • Published

writeson Travis Build Status

Micro-module for writing JSON easily to disk.

While being able to use require to read and deserialize a JSON file from disk, there is no such thing to write one.

var writeson = require("writeson");
 
var data = {
    foo: 23,
    bar: "fortytwo"
};
 
writeson("baz.json", data, function(err) {
    if(err) return console.err(err);
    console.log("Wrote JSON!");
});
 
var dataRestored = require("./baz.json");
 
// write the sync way:
writeson.sync("baz.json", data, "\t");
 
// change default indent when not specified:
writeson.defaultIndent = " ";

Package Sidebar

Install

npm i writeson

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • nikeee