storage module uploads files and images to managed cloud storage and returns
proxy URLs, plus reads and deletes existing files. Uploads are sent as
multipart/form-data — pass a browser File (e.g. from an <input type="file">)
or a Blob. There is no Uint8Array + mimeType path; the browser supplies
the content type.
Uploads are attributed to the logged-in user automatically (from the token) —
there is no
userId param. A user may delete files they own; reads are
project-scoped.uploadFile
Uploads a generic file (PDF, video, document, …) without server-side processing.The file to upload, as a browser
File or Blob.Storage path segments. The file is stored under the joined path with a UUID
sub-folder appended, e.g.
["documents", "reports"] →
documents/reports/<uuid>/<filename>.Filename for the multipart part. Defaults to the
File.name, or "upload".Display order when a record has multiple attachments.
Custom key-value data stored alongside the file record.
Associates the file with an entity for cascade deletion. Only one of
entityId / commentId / spaceId may be set.Associates the file with a comment for cascade deletion.
Associates the file with a space.
Promise<UploadFileResponse>:
uploadImage
Uploads an image, processes it server-side, and stores the original plus all requested variants. TheimageOptions object is a discriminated union on mode —
the other fields depend on the mode you pick.
The image to upload, as a browser
File or Blob. Must be a format the server
can process.Image-processing configuration — a discriminated union on
All modes also accept optional
mode. The supported
modes and their required fields:mode | Required fields | Notes |
|---|---|---|
exact-dimensions | dimensions ({ [variant]: { width, height } }) | Fixed-size crops. |
aspect-ratio-width-based | aspectRatio, widths ({ [variant]: number }) | Heights computed from the ratio. |
aspect-ratio-height-based | aspectRatio, heights ({ [variant]: number }) | Widths computed from the ratio. |
original-aspect | sizes ({ [variant]: number }) | Preserves source ratio; fit limited to inside/outside. |
multi-aspect-ratio | aspectRatios ({ width, height }[]), sizes | 1–10 aspect ratios. |
quality (1–100), format (webp | jpeg |
png | original), stripExif (boolean), and fit (cover | contain |
inside | outside). Dimension/size values are 50–10000.Filename for the multipart part. Defaults to the
File.name, or "upload".Storage path segments. Defaults to
["images", "<fileId>"].Associates the image with an entity. Only one of
entityId / commentId /
spaceId may be set.Associates the image with a comment.
Associates the image with a space.
Promise<UploadImageResponse>:
getFile
Fetches a file’s metadata and proxy URLs by ID. For images, animage extension
(variants, processing details) is included. Reads are project-scoped.
The ID of the file to retrieve.
Promise<GetFileResponse> — a flat projection carrying fileId,
type, originalPath, originalSize, originalMimeType, position, metadata,
createdAt/updatedAt, the optional association ids (userId, entityId,
commentId, spaceId), and — for images — an image object with variants,
processingStatus, format, quality, and exifStripped.
deleteFile
Deletes a file record and removes all associated storage objects (for images, every generated variant too).The ID of the file to delete.
Promise<void>
The call only succeeds when the logged-in user owns the file; otherwise it
returns
403.
