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
var readChunk = require('read-chunk');
 
// foo.txt => hello 
 
readChunk.sync('foo.txt', 1, 3);
//=> ell 

Type: string

Type: number

Position to start reading.

Type: number

Number of bytes to read.

Type: function

Same arguments as readChunk except the callback.

Returns a buffer.

MIT © Sindre Sorhus