1.0.5 • Published 12 months ago

@fastblob/fast-fetch v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

fast-fetch

fetch fastly in browser.

CI

How It Works

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.

Usage

import fetch from '@fastblob/fast-fetch';
const response = await fetch('https://example.com/test.bin', {
  fastFetch: {
    mirrorURLs: ['https://anotherexample.com/test.bin']
  }
});

Configuration

// src/get/request/types.ts

type FetchInput =  Parameters<typeof fetch>[0]

interface FastFetchGetConfig {
  mirrorURLs?: FetchInput[] // mirror URLs
  maxRetries?: number // max retry for each mirror
  retryDelay?: number // delay between retries
  logger?: Partial<Logger> // logger
  chunkCallback?: (chunk: Blob, range: [number, number], input: FetchInput) => void
}

Note

Only GET and HEAD requests are supported. Other methods will use the original fetch API.

Polyfills?

caniusepolyfill
AbortControllermo/abortcontroller-polyfill
Blob API: streameligrey/Blob.js
Promise.anyzloirock/corejs
TransformStreamMattiasBuelens/web-streams-polyfill

License

MIT

1.0.5

12 months ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago