fileSystem.DownloadOptions
Adds request headers to a download and follows its progress.
Utilização
Load an optional font
Este tipo é usado por 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 loadedDeclaração do tipo
export type DownloadOptions = {
headers?: Record<string, string>;
onProgress?: (progress: TransferProgress) => void;
};Membros 2
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
headers | Record<string, string> | Não | — |
onProgress | (progress: TransferProgress) => void | Não | — |
onProgress — assinaturas de método
Assinaturas
(progress: TransferProgress): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
progress | TransferProgress | Sim | — |
Devolve
void
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.