ctx.files in actions.
Hierarchy
-
Pick<FilesWriter,"grant"|"revoke"> ↳ActionFiles
Methods
grant
▸ grant(file, options): Promise<FileGrant>
Grant one recipient access to a protected file under current source
policy, until expires_at (epoch milliseconds). The recipient reads it
with the returned grant, itself a file locator. request_key makes a
retried grant return the grant it already issued.
Parameters
Returns
Promise<FileGrant>
Inherited from
Pick.grantrevoke
▸ revoke(grant): Promise<void>
Revoke one grant: no new read is admitted through it. Other grants and
the stored bytes are unchanged.
Parameters
Returns
Promise<void>
Inherited from
Pick.revokeopen
▸ open(file, options?): Promise<FileReader>
Open a file’s bytes for reading:
await using reader = await ctx.files.open(attachment(document, "source")).
A protected attachment is read through its record and field, decided on
every open as delivery decides it, unless this action already admitted
it; a source-derived file keeps its retained source rules, and an
ordinary file needs no route.
range reads only the bytes [start, end), which hold at least one
byte within the file. The read taints the action with the file’s
protection: what the action publishes afterwards carries it.
Parameters
Returns
Promise<FileReader>