promise-jsonfile
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

promise-jsonfile

Read and write JSON file with Promise.

Build Status 996.icu

This library is derived from node-jsonfile.

How to use

Typescript supported, check the demo.

Installation

npm install promise-jsonfile --save

Usage

import jsonfile from 'promise-jsonfile';
 
// read file
jsonfile
  .read('./your/file/path.json')
  .then(jsonData => {
    // do something
  })
  .catch(err => {
    throw err;
  });
 
// write file
jsonfile
  .write('./your/output/path.json', {
    your: 'json',
    data: 'here'
  })
  .then(() => {
    // do something
  })
  .cathc(err => {
    throw err;
  });

Licence

LICENSE

Package Sidebar

Install

npm i promise-jsonfile

Weekly Downloads

4

Version

1.1.2

License

Anti-996

Unpacked Size

7.26 kB

Total Files

6

Last publish

Collaborators

  • oyang