import { SourceHttp } from '@chunkd/source-http';
const source = new SourceHttp(new URL('https://example.com/cog.tif'));
const firstBuffer = await source.fetchBytes(0, 1024); // Load the first 1KB from the source
const lastBuffer = await source.fetchBytes(-1024); // load the last 1KB from the source
const size = source.metadata?.size; // File size if metadata has been fetched
相对 URL
相对urls, 使用 document.baseURI
const source = new SourceHttp(new URL('../cog.tif', document.baseURI));