1.0.0 • Published 7 years ago
read-big-file v1.0.0
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')
1.0.0
7 years ago