1.0.2 • Published 6 years ago

file-block-reader v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

FileBlockReader

Read files by blocks

Installation

npm i file-block-reader

Usage

const {FileBlockReader} = require('file-block-reader');

//...

//Read file by 5Mb blocks using callback
const reader = new FileBlockReader(filePath, 5 * 1024 * 1024);
reader.read((blockIndex: number, chunk: Buffer) => {

}, () => console.log('Complete!!!'));
//Or read file by 5Mb blocks using generator
const generator = reader.read();
while (true) {
    const {value, done} = generator.next(); //get next block buffer
    if (done) break;
}
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago