JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 311706
  • Score
    100M100P100Q164672F
  • License KINDLY

A small module to write JSON files.

Package Exports

  • w-json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (w-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

w-json Donate now

A small module to write JSON files.

If you want to read JSON files, check out r-json.

Installation

$ npm i w-json

Example

// Dependencies
var WriteJson = require("w-json");

// Write test.json asynchronously
WriteJson(__dirname + "/test.json", { "hello": "world" }, function (err, data) {
    console.log(err || "written");
});

// Write the same file synchronously
WriteJson(__dirname + "/test.json", { "hello": "mars" });

Documentation

wJson(path, data, space, callback)

Writes a JSON file.

Params

  • String path: The JSON file path.
  • Object data: The JSON data to write in the provided file.
  • Number space: An optional space value for beautifying the json output (default: 2)
  • Function callback: An optional callback. If not passed, the function will run in sync mode.

How to contribute

Have an idea? Found a bug? See how to contribute.

License

KINDLY © Ionică Bizău–The LICENSE file contains a copy of the license.