blob client from Creating the client.
put(file, options)
put() uploads one file and returns the new object.
Inputs
The object’s extension comes from
filename, then the path’s basename or the File’s name. Bytes and a plain Blob have no name, so pass filename (for example "data.json") when uploading them.
In Node.js, a path that cannot be opened throws a plain
Error (Cannot open file: <path>, with the original error in cause). In a browser, passing a path fails earlier, with the error from importing node:fs. Use a File from an <input type="file"> instead.Options
See Object Post for the full server-side rules.
Result
Simple and multipart uploads
put() picks the upload flow from the file size:
Every file must have at least 512 bytes; smaller files fail with
FILE_TOO_SMALL. A rule or upload token max_size, or your storage quota, can lower the 10 GiB ceiling.
How a multipart upload runs
- The SDK starts the upload, and the server answers with its part limits (
max_size,max_parts). - The file is split into parts of
min(max_size, max(16 MiB, ceil(size / max_parts)))bytes. A part is usually 16 MiB or more, but it is smaller when the server’smax_sizeis smaller. - Parts are sent 6 at a time, the server’s limit for parts in flight. A failed part is retried within
maxRetries. - When every part arrived, the SDK completes the upload.
put() again.
An account can have at most 32 open multipart uploads (shared with the S3 gateway); one more fails with
TOO_MANY_OPEN_UPLOADS. Since parts go 6 at a time per account, run one large upload at a time.Uploading from the browser
Never send the API key to a browser. Instead, your server mints a short-lived upload token and the browser uploads with it.- Server
- Browser
put(), including multipart uploads. Any other method fails with 403 UPLOAD_TOKEN_NOT_ALLOWED.
uploadTokens.create(options)
The token pins every option it was minted with.
It returns
{ token, expires_at, max_uses }. See Upload Tokens for the server-side rules.
uploadTokens.create() is a write and gets a single attempt: it is never retried.Next steps
Objects
List, update, copy, move and delete objects.
Upload API reference
The REST endpoints behind put().

