Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 950 Bytes

File metadata and controls

43 lines (28 loc) · 950 Bytes

@chunkd

File system abstraction to work with files from various sources

Usage

Load a chunks of data from a URL using fetch

import { fsa } from '@chunkd/fs';

const source = fsa.source(new URL('https://example.com/foo.zip'));

const firstBuffer = await source.fetch(0, 1024); // Load the first 1KB from the source
const lastBuffer = await source.fetch(-1024); // load the last 1KB from the source

const size = source.metadata?.size; // File size if metadata has been fetched

Building

This requires NodeJs >= 18

Use fnm to manage nodeJs versions

# Download the latest nodejs
fnm use 24

# Install node deps
npm

# Build everything into /build
npm run build

# Run the unit tests
npm run test