Skip to main content
The Bucket methods, their TypeScript options and what they return. Each section links to the concept page with the behaviour and defaults.
lib/blob.ts
Building the client is on Overview. Every method runs on your server with the bucket token.

put

lib/reports.ts
Every option is optional. Behaviour and defaults are on Writing. 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

A ReadableStream with neither throws length_required. Why is on Streams and unknown lengths.

uniquePath

Exported from @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

Returns { 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:
A missing object throws not_found. See get.

info and exists

See info and exists.

list

Returns { 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

Returns { 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

Anything else is refused with 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

A config for @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.