11.1.0 • Published 6 months ago
@chunkd/source-http v11.1.0
@chunkd/source-http
Load a chunks of a file from a HTTP(s) Source using fetch
Usage
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
Relative URLs
for relative urls, use document.baseURI
const source = new SourceHttp(new URL('../cog.tif', document.baseURI));
Advanced Usage
For caching, block alignment and fetch grouping see @chunkd/middleware and @chunkd/fs
Nodejs <18
Node.js <18 does not come with a default fetch
function, a fetch
method must be provided before being able to be used.
import { SourceHttp } from '@chunkd/source-http';
import { fetch } from 'node-fetch';
SourceHttp.fetch = fetch;
11.0.2
9 months ago
11.0.0
10 months ago
11.1.0
6 months ago
11.0.1
10 months ago
10.1.2
1 year ago
10.1.0
1 year ago
10.1.1
1 year ago
10.0.2
1 year ago
10.0.0
2 years ago
8.3.0
2 years ago
8.4.0
2 years ago
8.2.0
2 years ago
8.1.0
2 years ago
8.0.3
2 years ago
8.0.2
2 years ago
8.0.1
2 years ago
7.2.4
3 years ago
7.2.3
3 years ago
7.2.2
3 years ago
7.2.0
3 years ago
7.1.0
3 years ago
7.0.1
3 years ago
7.0.0
3 years ago