fileSystem.download
Streams url into the file at to, replacing it once the whole body has
arrived. A status outside 200–299 rejects with ERR_HTTP and writes nothing.
Utilisation
Load an optional font
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 loadedSignatures
(url: string, to: string, options?: DownloadOptions): FileTransfer<DownloadResult>Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
url | string | Oui | — |
to | string | Oui | — |
options | DownloadOptions | Non | — Par défaut: {} |
Retourne
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.