source: frontend/node_modules/bfj/src/read.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 779 bytes
Line 
1'use strict'
2
3const fs = require('fs')
4const parse = require('./parse')
5
6module.exports = read
7
8/**
9 * Public function `read`.
10 *
11 * Returns a promise and asynchronously parses a JSON file read from disk. If
12 * there are no errors, the promise is resolved with the parsed data. If errors
13 * occur, the promise is rejected with the first error.
14 *
15 * @param path: Path to the JSON file.
16 *
17 * @option reviver: Transformation function, invoked depth-first.
18 *
19 * @option yieldRate: The number of data items to process per timeslice,
20 * default is 16384.
21 *
22 * @option Promise: The promise constructor to use, defaults to bluebird.
23 **/
24function read (path, options) {
25 return parse(fs.createReadStream(path, options), { ...options, ndjson: false })
26}
Note: See TracBrowser for help on using the repository browser.