thedesk/app/node_modules/read-chunk
2018-02-19 02:41:25 +09:00
..
index.js TheDesk Riina (ver.3) 2018-02-19 02:41:25 +09:00
package.json TheDesk Riina (ver.3) 2018-02-19 02:41:25 +09:00
readme.md TheDesk Riina (ver.3) 2018-02-19 02:41:25 +09:00

read-chunk Build Status

Read a chunk from a file

Because the built-in way is too much boilerplate.

Install

$ npm install --save read-chunk

Usage

var readChunk = require('read-chunk');

// foo.txt => hello

readChunk.sync('foo.txt', 1, 3);
//=> ell

API

readChunk(filepath, position, length, callback)

filepath

Type: string

position

Type: number

Position to start reading.

length

Type: number

Number of bytes to read.

callback(error, buffer)

Type: function

readChunk.sync(filepath, start, length)

Same arguments as readChunk except the callback.

Returns a buffer.

License

MIT © Sindre Sorhus