get the first chunk of readable stream
npm install first-chunk --save
yarn add first-chunk
const firstChunk = require('first-chunk')
const options = {
encoding: 'utf8',
size: 12 // defaults to 16384 (16kb)
}
firstChunk('path/to/file', options)
.then(data => {
console.log(data)
})
.catch(e => {
console.log(e)
})
MIT