read-big-file

1.0.0 • Public • Published

read-big-file

The Problem:

fs.readFile and fs.readFileSync cannot handle files larger than a couple dozen megabytes.

The Solution:

Readstreams can handle much, much larger amounts of data, and I found myself writing the same bit of code over and over, so I decided to put it in its own package.

Usage

const readBigFile = require('read-big-file');
readBigFile('./bigFile').then((contents) => {
  // Do Something
}).catch((err) => {
  // An error occurred
});

readBigFile accepts three arguments:

  • path - The path to the file
  • json (optional) - If true, readBigFile will safely try to decode a JSON object from the file (defaults to false)
  • encoding (optional) - The encoding of the file (defaults to 'utf-8')

Readme

Keywords

none

Package Sidebar

Install

npm i read-big-file

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nmde