# read-json5-file

> Read and parse a JSON5 file

Latest version **2.0.0** (published 2026-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install read-json5-file
pnpm add read-json5-file
yarn add read-json5-file
bun add read-json5-file
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-03-11 |
| First published | 2019-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=22.13 |
| Dependencies | 2 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | Zoltan Kochan |
| Maintainers | zkochan |
| Keywords | read, JSON5, parse, file, fs, graceful, load |

## Links

- npm: https://www.npmjs.com/package/read-json5-file
- Repository: https://github.com/zkochan/packages/tree/main/read-json5-file
- Homepage: https://github.com/zkochan/packages/tree/main/read-json5-file#readme
- npm.io page: https://npm.io/package/read-json5-file

## Dependencies (2)

- [json5](https://npm.io/package/json5.md) ^2.2.3
- [strip-bom](https://npm.io/package/strip-bom.md) ^5.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-03-11
- 1.0.0 (next) — 2021-02-11
- 0.0.0 — 2019-04-28

## README

# read-json5-file

> Read and parse a JSON5 file

<!--@shields('npm')-->
[![npm version](https://img.shields.io/npm/v/read-json5-file.svg)](https://www.npmjs.com/package/read-json5-file)
<!--/@-->

[Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom) and uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).

## Installation

```sh
<npm|yarn|pnpm> add read-json5-file
```

## Usage

```js
'use strict'
const loadJson5File = require('read-json5-file')
const path = require('path')

const fixture = path.join(__dirname, 'countries.json5')
const countries = loadJson5File.sync(fixture)
console.log(countries)
//> [ 'Ukraine', 'Hungary', 'Slovakia' ]
```

## API

### `loadJson5File(filepath)`

Returns a promise for the parsed JSON5.

### `loadJson5File.sync(filepath)`

Returns the parsed JSON5.

## Related

- [write-json5-file](../write-json5-file) - Stringify and write JSON5 to a file atomically
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
- [json5](https://github.com/json5/json5) - JSON for the ES5 era

## License

[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io)

---
_Source: https://npm.io/package/read-json5-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
