Interface: StorageReader
server.StorageReader
An interface to read files from storage within Convex query functions.
Hierarchy
-
StorageReader
Methods
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.
Parameters
| Name | Type | Description |
|---|---|---|
storageId | GenericId<"_storage"> | The Id<"_storage"> of the file to fetch from Convex storage. |
Returns
Promise<null | string>
- A url which fetches the file via an HTTP GET, or
nullif it no longer exists.
Defined in
▸ 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
| Name | Type |
|---|---|
T | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
storageId | T extends { __tableName: any } ? never : T | 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
nullif it no longer exists.
Defined in
getMetadata
▸ getMetadata(storageId): Promise<null | FileMetadata>
Deprecated
This function is deprecated, use db.system.get(Id<"_storage">) instead.
Get metadata for a file.
Parameters
| Name | Type | Description |
|---|---|---|
storageId | GenericId<"_storage"> | The Id<"_storage"> of the file. |
Returns
Promise<null | FileMetadata>
- A FileMetadata object if found or
nullif not found.
Defined in
▸ getMetadata<T>(storageId): Promise<null | FileMetadata>
Deprecated
This function is deprecated, use db.system.get(Id<"_storage">) instead.
Get metadata for a file.
Type parameters
| Name | Type |
|---|---|
T | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
storageId | T extends { __tableName: any } ? never : T | The StorageId of the file. |
Returns
Promise<null | FileMetadata>
- A FileMetadata object if found or
nullif not found.