Skip to content

Latest commit

 

History

History

source-file

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

@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