0.0.0 • Published 4 years ago
read-json5-file v0.0.0
read-json5-file
Read and parse a JSON5 file
Strips UTF-8 BOM and uses graceful-fs
.
Installation
<npm|yarn|pnpm> add read-json5-file
Usage
'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 - Stringify and write JSON5 to a file atomically
- load-json-file - Read and parse a JSON file
- json5 - JSON for the ES5 era