FileInfo
What info finds at a URI. lastModified is milliseconds since 1970, as File.lastModified.
Verwendung
Write a note and download a photo
Dieser Typ wird verwendet von fileSystem.info
import { Image, fileSystem } from 'kuito';
const url = 'https://example.com/photo.jpg';
const notes = fileSystem.documents + 'notes.txt';
await fileSystem.write(notes, 'hello');
await fileSystem.write(notes, ' world', { append: true });
await fileSystem.read(notes); // 'hello world'
await fileSystem.readBytes(notes, { position: 6, length: 5 }); // an ArrayBuffer of 'world'
await fileSystem.info(notes); // { exists: true, uri, isDirectory: false, size: 11, lastModified }
await fileSystem.delete(notes);
const photo = fileSystem.download(url, fileSystem.cache + 'photo.jpg', {
headers: { Authorization: 'Bearer …' },
onProgress: ({ bytes, total }) => console.log(bytes, total),
});
const { uri } = await photo; // or photo.cancel()
export const Photo = () => <Image src={{ uri }} />;Typdeklaration
export type FileInfo =
| { exists: false; uri: string }
| { exists: true; uri: string; isDirectory: boolean; size: number; lastModified: number };Mitglieder 2
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
exists | boolean | Ja | — |
uri | string | Ja | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.