JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 36127
  • Score
    100M100P100Q136595F
  • License MIT

Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.

Package Exports

  • write-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 (write-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

write-json NPM version NPM monthly downloads Linux Build Status

Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.

Install

Install with npm:

$ npm install --save write-json

Install with yarn:

$ yarn add write-json

Usage

var writeJson = require('write-json'); 

// async
writeJson('foo.json', {abc: 'xyz'}, function(err) {
  // do stuff with err
});

// sync
writeJson.sync('foo.json', {abc: 'xyz'});

JSON.stringify

Supports the same arguments as JSON.stringify

// async
writeJson('foo.json', {abc: 'xyz'}, null, 2, function(err) {
  // do stuff with err
});

// sync
writeJson.sync('foo.json', {abc: 'xyz'}, null, 2);

About

  • delete: Delete files and folders and any intermediate directories if they exist (sync and async). | homepage
  • read-data: Read JSON or YAML files. | homepage
  • read-json: Reads and parses a JSON file. | homepage
  • read-yaml: Very thin wrapper around js-yaml for directly reading in YAML files. | homepage
  • write-yaml: Write YAML. Converts JSON to YAML writes it to the specified file. | homepage
  • write: Write files to disk, creating intermediate directories if they don't exist. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.5.0, on April 12, 2017.