Hierarchy
-
StorageWriter -
BijectionStorageReader↳BijectionStorageWriter
Methods
inspectProtectedFile
▸ inspectProtectedFile(storageId): Promise<ProtectedFileBinding>
Inspect a protected file’s logical lifecycle in this transaction. The
native row and current source permissions are read dependencies, so an
erasure racing this transaction refuses its result or commit. Missing,
ordinary, erased, and unauthorized files do not disclose metadata.
This does not verify that physical blob bytes still exist.
Parameters
Returns
Promise<ProtectedFileBinding>
Inherited from
BijectionStorageReader.inspectProtectedFileprepareUpload
▸ prepareUpload<Completion>(options): Promise<string>
Prepare a client upload that already names what the file is for, and
return its single-use upload URL (valid for an hour).
The client POSTs the bytes to the URL, authenticated as the same user
(BijectionHttpClient.uploadFile). Size, content type and digest are
enforced while the bytes arrive. Then one transaction stores the file and
runs complete as that user with { file, ...args }, so the completion
checks authorization when the file becomes real, and a file whose
completion throws is never published and its bytes are reclaimed. The
file is protected when the preparation or the completion read protected
data. A retry after a lost response returns the same file without
running the completion again.
Example
Type parameters
Parameters
Returns
Promise<string>
share
▸ share(storageId, options): Promise<string>
Grant one recipient access to a protected file under current source policy.
Parameters
Returns
Promise<string>
revokeShare
▸ revokeShare(storageId, shareId): Promise<void>
Revoke one grant without changing other grants or the stored bytes.
Parameters
Returns
Promise<void>
getUrl
▸ getUrl(storageId): Promise<null | string>
Get the URL for a file in storage by its Id<"_storage">.
The GET response includes a standard HTTP Digest header with a sha256 checksum.
Example
Parameters
Returns
Promise<null | string>
- A URL which fetches the file via an HTTP GET, or
nullif the file no longer exists.
Inherited from
BijectionStorageReader.getUrl ▸ getUrl<T>(storageId): Promise<null | string>
Deprecated
Passing a string is deprecated, use storage.getUrl(Id<"_storage">) instead.
Get the URL for a file in storage by its StorageId.
The GET response includes a standard HTTP Digest header with a sha256 checksum.
Type parameters
Parameters
Returns
Promise<null | string>
- A url which fetches the file via an HTTP GET, or
nullif it no longer exists.
Inherited from
BijectionStorageReader.getUrlgetMetadata
▸ getMetadata(storageId): Promise<null | FileMetadata>
Deprecated
Use ctx.db.system.get("_storage", storageId) instead, which returns
equivalent metadata from the _storage system table (with a slightly different shape):
Parameters
Returns
Promise<null | FileMetadata>
- A FileMetadata object if found or
nullif not found.
Inherited from
BijectionStorageReader.getMetadata ▸ getMetadata<T>(storageId): Promise<null | FileMetadata>
Deprecated
Use ctx.db.system.get("_storage", storageId) instead.
Get metadata for a file.
Type parameters
Parameters
Returns
Promise<null | FileMetadata>
- A FileMetadata object if found or
nullif not found.
Inherited from
BijectionStorageReader.getMetadatagenerateUploadUrl
▸ generateUploadUrl():Promise<string>
Generate a short-lived URL for uploading a file into storage.
The client should make a POST request to this URL with the file as the
body. The response will be a JSON object containing a newly allocated
Id<"_storage"> ({ storageId: "..." }).
Example
Returns
Promise<string>
- A short-lived URL for uploading a file via HTTP POST.
Inherited from
StorageWriter.generateUploadUrldelete
▸ delete(storageId): Promise<void>
Delete a file from Bijection storage.
Once a file is deleted, any URLs previously generated by getUrl will return 404s.
Example
Parameters
Returns
Promise<void>
Inherited from
StorageWriter.delete ▸ delete<T>(storageId): Promise<void>
Deprecated
Passing a string is deprecated, use storage.delete(Id<"_storage">) instead.
Delete a file from Bijection storage.
Once a file is deleted, any URLs previously generated by getUrl will return 404s.
Type parameters
Parameters
Returns
Promise<void>