Skip to content
API reference

files

Import
import * as api from "@fungi.computer/agar/files";
Kind Export Description
type alias AppFileRead A parent-owned read. Closing it aborts the parent HTTP operation.
type alias AppFileWrite A parent-owned upload; close requests transport abort, never promises rollback.
function readAppFile() Native Response crosses RPC; File is constructed only in the receiving App.
function writeAppFile() Stream a Blob’s bytes to a parent-owned upload. Aborting signal closes the upload early; a close failure after a successful write is reported, never thrown, since it cannot change an already-acknowledged commit.

AppFileReadtype alias

Section titled “AppFileRead”
Signature
type AppFileRead = Disposable & object;

A parent-owned read. Closing it aborts the parent HTTP operation.

Name Type Description
response() () => Promise<Response> Resolve with the underlying Response once it is available.
close() () => Promise<void> Release the parent’s open read, aborting it if still in flight.

AppFileWritetype alias

Section titled “AppFileWrite”
Signature
type AppFileWrite = Disposable & object;

A parent-owned upload; close requests transport abort, never promises rollback.

Name Type Description
write() (content) => Promise<void> Stream the upload’s content to the parent-owned destination.
close() () => Promise<void> Request that the parent abort or finalize the upload transport.

readAppFile()function

Section titled “readAppFile()”
Signature
function readAppFile(read, options): Promise<File>;

Native Response crosses RPC; File is constructed only in the receiving App.

Parameter Type
read AppFileRead
options { name: string; signal?: AbortSignal; }
options.name string
options.signal? AbortSignal

Promise<File>


writeAppFile()function

Section titled “writeAppFile()”
Signature
function writeAppFile(write, content, options): Promise<void>;

Stream a Blob’s bytes to a parent-owned upload. Aborting signal closes the upload early; a close failure after a successful write is reported, never thrown, since it cannot change an already-acknowledged commit.

Parameter Type
write AppFileWrite
content Blob
options { signal?: AbortSignal; }
options.signal? AbortSignal

Promise<void>