fileSystem.WriteOptions
Says whether fileSystem.write() replaces the file or adds to its end.
Utilização
Write a note and download a photo
Este tipo é usado por fileSystem.write
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 }} />;Declaração do tipo
export type WriteOptions = {
/** Adds to the end of the file instead of replacing it. */
append?: boolean;
};Membros 1
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
append | boolean | Não | Adds to the end of the file instead of replacing it. |
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.