Bring Your Own Backend
Download
Return a signed or proxied download URL from a custom backend.
download returns a GET URL. The default is a short-lived S3 URL with
mode: "presign". A backend that streams the body itself returns a
same-origin URL with mode: "proxy".
The payload has route, key, and optional name, disposition, and
expiresIn. name is the file name for Content-Disposition. expiresIn is
a requested TTL in seconds: sign the shorter of that value and your route's
cap.
Prop
Type
Return the disposition you signed. In presign mode, return the expiresIn
you actually signed: useObjectUrl uses it to refresh the URL before it
expires. Leave it out in proxy mode.
Prop
Type
Example
@dimah-s3/server uses
GET /api/s3/presign/download?route=…&key=….
import type {
DownloadPayload,
DownloadPresignResponse,
S3RequestOptions,
} from "@dimah-s3/core";
import { $fetch, call } from "./fetch";
export const download = (
payload: DownloadPayload,
options?: S3RequestOptions,
) =>
$fetch<DownloadPresignResponse>("/download", {
method: "GET",
query: payload,
...call(options),
});$fetch and call come from the
skeleton.