JavaScript fetch in parallel and segmented way
npm install @fastblob/fast-fetchfetch fastly in browser.

fast-fetch is a drop-in replacement of fetch API, it segments the request into multiple chunks, and fetch them in parallel, then merge them into a single response.
``js`
import fetch from '@fastblob/fast-fetch';
const response = await fetch('https://example.com/test.bin', {
fastFetch: {
mirrorURLs: ['https://anotherexample.com/test.bin']
}
});
` ts
// src/get/request/types.ts
type FetchInput = Parameters
interface FastFetchGetConfig {
mirrorURLs?: FetchInput[] // mirror URLs
maxRetries?: number // max retry for each mirror
retryDelay?: number // delay between retries
logger?: Partial
chunkCallback?: (chunk: Blob, range: [number, number], input: FetchInput) => void
}
`
Only GET and HEAD requests are supported. Other methods will use the original fetch API.
MIT