DownloadOptions
Adds request headers to a download and follows its progress.
Usage
Load an optional font
This type is used by fileSystem.download
import { fileSystem, fonts } from 'kuito';
const LATO = 'https://raw.githubusercontent.com/google/fonts/main/ofl/lato/';
const regular = fileSystem.cache + 'Lato-Regular.ttf';
const bold = fileSystem.cache + 'Lato-Bold.ttf';
await fileSystem.download(LATO + 'Lato-Regular.ttf', regular);
await fileSystem.download(LATO + 'Lato-Bold.ttf', bold);
await fonts.load({ Lato: [regular, { uri: bold, weight: 'bold' }] });
fonts.loaded('Lato'); // true: bundled or loadedType declaration
export type DownloadOptions = {
headers?: Record<string, string>;
onProgress?: (progress: TransferProgress) => void;
};Members 2
| Name | Type | Required | Description |
|---|---|---|---|
headers | Record<string, string> | No | — |
onProgress | (progress: TransferProgress) => void | No | — |
onProgress — method signatures
Signatures
(progress: TransferProgress): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
progress | TransferProgress | Yes | — |
Returns
void
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.