Parse a JSON file in Node.js, Deno, ESM, and CJS

@bevry/jsonfile

Read/Parse/Write a JSON file in Node.js, Deno, ESM, and CJS.

Usage

Complete API Documentation.

Read a JSON file

import readJSON from '@bevry/jsonfile'
readJSON('some/json-file.json')
    .then(console.log)
    .catch((err) => throw err)

Write a JSON file

import { writeJSON } from '@bevry/jsonfile'
writeJSON('some/json-file.json', {some: 'data'})
    .then(() => console.log('done'))
    .catch((err) => throw err)

Install

npm

  • Install: npm install --save @bevry/jsonfile
  • Import: import pkg from ('@bevry/jsonfile')
  • Require: const pkg = require('@bevry/jsonfile').default

Deno

import pkg from 'https://unpkg.com/@bevry/jsonfile@^1.0.0/edition-deno/index.ts'

Editions

This package is published with the following editions:

  • @bevry/jsonfile/source/index.ts is TypeScript source code with Import for modules
  • @bevry/jsonfile aliases @bevry/jsonfile/edition-esnext/index.js
  • @bevry/jsonfile/edition-esnext/index.js is TypeScript compiled against ESNext for Node.js 10 || 12 || 13 || 14 with Require for modules
  • @bevry/jsonfile/edition-esnext-esm/index.js is TypeScript compiled against ESNext for Node.js 12 || 13 || 14 with Import for modules
  • @bevry/jsonfile/edition-deno/index.ts is TypeScript source code made to be compatible with Deno

History

Discover the release history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Download Details:

Author: bevry

Source Code: https://github.com/bevry/jsonfile

#nodejs #node #javascript

Parse a JSON file in Node.js, Deno, ESM, and CJS
2.75 GEEK