Bring Your Own Backend
Delete
Delete one or many objects through your custom backend.
Deleting is a request to your backend, not a presigned transfer. Delete is idempotent: a key that does not exist still succeeds.
Delete one
delete receives a route and one object key.
Prop
Type
Prop
Type
Delete many
deleteMany receives one route and between 1 and 100 keys
(DELETE_MANY_MAX_KEYS). useDelete splits larger calls into batches of that
size.
Prop
Type
Delete each key on its own. Put it in deleted, or in failed with an error
body { code, message, params? }. A key you leave out of both fails with
UNKNOWN_ERROR.
Prop
Type
Example
@dimah-s3/server uses DELETE /api/s3/delete?route=…&key=…
and POST /api/s3/delete/batch.
import type {
DeleteManyPayload,
DeleteManyResponse,
DeletePayload,
DeleteResponse,
S3RequestOptions,
} from "@dimah-s3/core";
import { $fetch, call } from "./fetch";
export const deleteObject = (
payload: DeletePayload,
options?: S3RequestOptions,
) =>
$fetch<DeleteResponse>("/delete", {
method: "DELETE",
query: payload,
...call(options),
});
export const deleteMany = (
payload: DeleteManyPayload,
options?: S3RequestOptions,
) =>
$fetch<DeleteManyResponse>("/delete/batch", {
method: "POST",
body: payload,
...call(options),
});$fetch and call come from the
skeleton.