Bucket methods, their TypeScript options and what they return. Each section links to the concept page with the behaviour and defaults.
lib/blob.ts
put
lib/reports.ts
The result is a
CompletedBlob:
Bodies
app/api/avatar/route.ts
PutBody is one of these. If the body does not carry its own length or type, declare size or contentType yourself.
An explicit
contentType wins over what the body carries.
A Request with no body, or one that has already been read, throws empty_body. Anything else is a TypeError. A Request that arrived chunked has no content-length and counts as an unknown length, like a stream.
Streams
ReadableStream with neither throws length_required. Why is on Streams and unknown lengths.
uniquePath
@upstash/blob. The suffix rules are on Unique paths.
updateJson
The loop and its defaults are on Updating JSON.
copy and move
What carries over from the source is on copy and move.
signedUploadUrl
{ url: string, headers: Record<string, string>, expiresAt: Date }. Send headers verbatim.
Defaults and lifetimes are on Signed upload URLs.
get
body is a ReadableStream<Uint8Array> and nothing is buffered for you. Wrap it in a Response for the usual conversions:
not_found. See get.
info and exists
list
{ blobs: BlobObject[], cursor: string | undefined }.
Defaults and paging are on list.
publicUrl
undefined on a private bucket. An empty path, or one with a . or .. segment, throws a TypeError. See Public URLs.
signedReadUrl
{ url: string, expiresAt: Date }. Cache the link until expiresAt, never until a deadline you compute from expiresIn.
Defaults and lifetimes are on Signed read URLs.
del
invalid_input. A path with a . or .. segment throws a TypeError. What each shape does and throws is on Deleting.
Multipart cleanup
olderThan is required. See Incomplete multipart uploads.
s3
@aws-sdk/client-s3. See Using an S3 client.
Records
Four record types come back from the SDK. They nest. What each field means is on Records.
All four are exported as types from
@upstash/blob.