Socket
Socket
Sign inDemoInstall

load-json-file

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    load-json-file

Read and parse a JSON file


Version published
Weekly downloads
19M
increased by2.26%
Maintainers
1
Install size
6.29 kB
Created
Weekly downloads
 

Readme

Source

load-json-file

Read and parse a JSON file

It also strips UTF-8 BOM.

Install

$ npm install load-json-file

Usage

import {loadJsonFile} from 'load-json-file';

console.log(await loadJsonFile('foo.json'));
//=> {foo: true}

API

loadJsonFile(filePath, options?)

Returns a Promise<unknown> with the parsed JSON.

loadJsonFileSync(filepath, options?)

Returns the parsed JSON.

options

Type: object

beforeParse

Type: Function

Applies a function to the JSON string before parsing.

reviver

Type: Function

Prescribes how the value originally produced by parsing is transformed, before being returned. See the JSON.parse docs for more.

load-json-file for enterprise

Available as part of the Tidelift Subscription.

The maintainers of load-json-file and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

  • write-json-file - Stringify and write JSON to a file atomically

Keywords

FAQs

Last updated on 13 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc