Interface: StorageWriter
server.StorageWriter
An interface to write files to storage within Convex mutation functions.
Hierarchy
-
↳
StorageWriter
Methods
getUrl
▸ getUrl(storageId
): Promise
<null
| string
>
Get the URL for a file in storage by its StorageId.
The GET response includes a standard HTTP Digest header with a sha256 checksum.
Parameters
Name | Type | Description |
---|---|---|
storageId | string | The StorageId of the file to fetch from Convex storage. |
Returns
Promise
<null
| string
>
- A url which fetches the file via an HTTP GET, or
null
if it no longer exists.
Inherited from
Defined in
getMetadata
▸ getMetadata(storageId
): Promise
<null
| FileMetadata
>
Get metadata for a file.
Parameters
Name | Type | Description |
---|---|---|
storageId | string | The StorageId of the file. |
Returns
Promise
<null
| FileMetadata
>
- A FileMetadata object if found or
null
if not found.
Inherited from
Defined in
generateUploadUrl
▸ generateUploadUrl(): Promise
<string
>
Fetch a short-lived URL for uploading a file into storage.
Upon a POST request to this URL, the endpoint will return a JSON object containing a newly allocated StorageId.
The POST URL accepts an optional standard HTTP Digest header with a sha256 checksum.
Returns
Promise
<string
>
- A url that allows file upload via an HTTP POST.
Defined in
delete
▸ delete(storageId
): Promise
<void
>
Delete a file from Convex storage.
Once a file is deleted, any URLs previously generated by getUrl will return 404s.
Parameters
Name | Type | Description |
---|---|---|
storageId | string | The StorageId of the file to delete from Convex storage. |
Returns
Promise
<void
>