npm.devtool.tech
👏 You can access read-chunk package with using readChunk variable in browser devtools!
Read a chunk from a file

code/package/bundle size

0B
publish
0B
install
0B
bundle minified
0B
bundle gzipped

read-chunk

Read a chunk from a file

Because the built-in way requires way too much boilerplate.

Install

$ npm install read-chunk

Usage

import {readChunk} from 'read-chunk';

// foo.txt => hello

await readChunk('foo.txt', {length: 3, startPosition: 1});
//=> 'ell'

API

readChunk(filePath, {length, startPosition})

Returns a Promise<Buffer> with the read chunk.

readChunkSync(filePath, {length, startPosition})

Returns a Buffer with the read chunk.

filePath

Type: string

length

Type: number

The number of bytes to read.

startPosition

Type: number

The poosition to start reading from.

🔎Explore Package🔎CDN Script

Score

Popularity30/100
Quality84/100
Maintenance100/100

Dependencies