5.0.0 • Published 1 year ago

read-chunk v5.0.0

Weekly downloads
1,085,323
License
MIT
Repository
github
Last release
1 year ago

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<Uint8Array> with the read chunk.

readChunkSync(filePath, {length, startPosition})

Returns a Uint8Array with the read chunk.

filePath

Type: string

length

Type: number

The number of bytes to read.

startPosition

Type: number

The position to start reading from.

5.0.0

1 year ago

4.0.3

3 years ago

4.0.1

4 years ago

4.0.2

4 years ago

4.0.0

4 years ago

3.2.0

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.1.0

8 years ago

2.0.0

10 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.1.0

12 years ago