node package manager

read-chunk

Read a chunk from a file

read-chunk

Read a chunk from a file

Because the built-in way is too much boilerplate.

$ npm install --save read-chunk
const readChunk = require('read-chunk');
 
// foo.txt => hello 
 
readChunk.sync('foo.txt', 1, 3);
//=> 'ell' 

Returns a promise for a buffer.

Returns a buffer.

Type: string

Type: number

Position to start reading.

Type: number

Number of bytes to read.

MIT © Sindre Sorhus