File system abstraction to work with files from various sources
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
This requires NodeJs >= 18 & Yarn
Use fnm to manage nodeJs versions
# Download the latest nodejs & yarn
fnm use 18
npm install -g yarn
# Install node deps
yarn
# Build everything into /build
yarn run build
# Run the unit tests
yarn run test