API reference
files
Import
Section titled “Import”import * as api from "@fungi.computer/agar/files";Exports
Section titled “Exports”| 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”type AppFileRead = Disposable & object;A parent-owned read. Closing it aborts the parent HTTP operation.
Type Declaration
Section titled “Type Declaration”| 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”type AppFileWrite = Disposable & object;A parent-owned upload; close requests transport abort, never promises rollback.
Type Declaration
Section titled “Type Declaration”| 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()”function readAppFile(read, options): Promise<File>;Native Response crosses RPC; File is constructed only in the receiving App.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
read |
AppFileRead |
options |
{ name: string; signal?: AbortSignal; } |
options.name |
string |
options.signal? |
AbortSignal |
Returns
Section titled “Returns”Promise<File>
writeAppFile()function
Section titled “writeAppFile()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
write |
AppFileWrite |
content |
Blob |
options |
{ signal?: AbortSignal; } |
options.signal? |
AbortSignal |
Returns
Section titled “Returns”Promise<void>