Bring your own backend
Multipart
init, signPart, listParts, complete, and abort — large-file uploads.
Split a large file into parts. Each part is a presigned PUT; your backend orchestrates init, signing, complete, and abort.
Flow: init → signPart (per part) → complete or abort · listParts
to resume.
Init
Same payload shape as simple upload.
Prop
Type
Prop
Type
Sign part
Prop
Type
Prop
Type
List parts
Prop
Type
Prop
Type
Complete
Prop
Type
Prop
Type
Abort
Same payload shape as list-parts.
Prop
Type
Prop
Type
import type {
MultipartInitPayload,
MultipartInitResponse,
MultipartSignPartPayload,
MultipartPartResponse,
MultipartListPartsPayload,
MultipartListPartsResponse,
MultipartCompletePayload,
MultipartCompleteResponse,
MultipartAbortPayload,
MultipartAbortResponse,
} from "@dimah-s3/core";Example
Add this to the defineApi skeleton.
@dimah-s3/server mounts these under
/api/s3/presign/multipart/*.
const base = "/api/files/presign/multipart";
async function post<T>(url: string, body: unknown): Promise<T> {
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}
multipart: {
init: (payload) => post(`${base}/init`, payload),
signPart: (payload) => post(`${base}/part`, payload),
async listParts(payload) {
const params = new URLSearchParams({
route: payload.route,
key: payload.key,
uploadId: payload.uploadId,
});
const res = await fetch(`${base}/parts?${params}`);
if (!res.ok) throw new Error(await res.text());
return res.json();
},
complete: (payload) => post(`${base}/complete`, payload),
abort: (payload) => post(`${base}/abort`, payload),
}