0.5.0 • Published 2 years ago

@nishin/node-file-reader v0.5.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Asynchronous binary reader for Node.JS

Read various data types from a file handle in a streamlined way

NPM Version

The NodeFileReader class implements file handle access on top of the AsyncReader class and is suitable to read very large files as the file is only partially loaded into memory while traversing it. The API layer is almost identical to the BinaryReader class, only that most methods return promises instead.

For details on supported data types consult the @nishin/reader readme.

Usage

import fs from 'node:fs/promises';

import { NodeFileReader, DataType } from '@nishin/node-file-reader';

const reader = new NodeFileReader(await fs.open('/path/to/large/file'), ByteOrder.BigEndian, { bufferSize: 8192 });

const data = await reader.next(DataType.Uint8);

await reader.close();