OptionalgetOptional. Given { type, userId, data }, returns the S3 object key for the upload. If omitted, a UUID is generated.
Required. Called after each successful upload with { url, type, userId, data }.
The return value is included in the API response as onUploadResponse (e.g. save metadata to your database and return it).
OptionalprocessOptional. Given the uploaded file and { type, userId, data }, returns the blob to
store in its place — e.g. re-encoding an image, or stripping metadata. Runs after authentication and before the
S3 write, so only the returned bytes are ever stored. The blob's type becomes the object's Content-Type,
so change it when the format changes. Return the file unchanged to leave it alone. Throwing fails the upload.
OptionalputOptional. Given { type, userId, data }, returns fields to set on the S3 put —
CacheControl, ContentDisposition, Metadata and so on. A function rather than a static object so
headers can differ per upload kind. See PutOverrides.
Options for setting up file upload via setupFileUpload.
Every callback receives the same
{ type, userId, data }context.datais optional — it is whatever the caller passed asconfig.datatouseFileUpload, and the client only appends the form field when a value is given, so the route parses it toundefinedotherwise. Narrow it before use; destructuring it unguarded throws at runtime.