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.
Verwendung
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 loadedSignaturen
(url: string, to: string, options?: DownloadOptions): FileTransfer<DownloadResult>Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
url | string | Ja | — |
to | string | Ja | — |
options | DownloadOptions | Nein | — Standard: {} |
Rückgabe
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.