Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Json

Read and write JSON files

This package contains functions to read and write JSON to and from files.

Install

npm install @b127/json

usage

import { readJson, writeJson } from '@b127/json';

(async () => {
  // read JSON from file
  const data = await readJson('./package.json');

  // write JSON to file
  await writeJson('./file.json', { hello: 'world' });
})();

API

readJson(file)

Open (JSON) file and parse data. Returns a Promise with the parsed data.

file

Type: string

File to read JSON from.

writeJson(file, data)

Write data as JSON to a file. Returns Promise<void>.

file

Type: string

File to write data to.

data

Type: any

Data to write as JSON.

About

Read and write JSON files

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages