npm.io
11.2.1 • Published 4 months ago

@chunkd/source-file

Licence
MIT
Version
11.2.1
Deps
1
Size
13 kB
Vulns
0
Weekly
0

@chunkd/source-file

Load chunks of data from a file using node:fs

Usage

import { pathToFileURL } from 'node:path';
import { SourceFile } from '@chunkd/source-file';

const source = new SourceFile(pathToFileURL('./cog.tif'));

// Read in the first 1KB of data
await source.fetch(0, 1024);

// Read the last 1KB of data
await source.fetch(-1024);

Advanced Usage

For caching, block alignment and fetch grouping see @chunkd/middleware and @chunkd/fs