rc

read-chunk

Read a chunk from a file

Showing:

Popularity

Downloads/wk

838K

GitHub Stars

94

Maintenance

Last Commit

2mos ago

Contributors

7

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial