env.<BINDING> (a CloudStorageBucket) is the in-function handle to a Cloud Storage bucket, declared with a [storage.cloudstorage.<name>] block. It’s a pre-authenticated wrapper over the bucket — the runtime injects the credential, so your code holds no S3 access key or secret key.
- Missing keys read as
null—getandheadresolve tonullfor a key that doesn’t exist, not an error. deleteis idempotent — deleting a missing key succeeds and resolves tovoid.putreturns partial metadata — the resolved object carrieskey,etag,httpEtag, and any metadata you set, but notsizeoruploaded. Useheadto read those after a write.- Custom metadata keys are lower-cased on read —
x-amz-meta-*header names are stored lower-cased, socustomMetadatakeys come back lower-cased (uploadedBy→uploadedby). - No multipart on the binding — the surface is
get/put/head/delete/list. For very large objects, use multipart upload or a presigned URL over the S3 API.
get(key)
Read an object and its body. Returns null if the key does not exist.
CloudStorageObjectBody — a CloudStorageObject plus the body and one-shot readers arrayBuffer(), text(), json(), and blob().
put(key, body, options?)
Write an object. body is a string, Uint8Array, or ReadableStream. Resolves to a CloudStorageObject describing the write.
key, etag (unquoted MD5 for a single-part write), httpEtag (the quoted, header-ready form), and the metadata you set. size and uploaded are not populated on the put result — read them back with head if you need them.
head(key)
Read an object’s metadata without its body. Returns null if the key does not exist.
put, head returns the full CloudStorageObject including size and uploaded.
delete(key)
Remove an object. Idempotent — deleting a missing key resolves normally.
list(options?)
Enumerate objects (metadata only — list does not return bodies).
truncated is true, pass the returned cursor back in list({ cursor }) to fetch the next page.
Object types
head and each list entry populate size and uploaded; put’s result does not. The body readers on CloudStorageObjectBody consume the stream once — call a single one per get.
Related
- Use a bucket from an Edge Function — declare the binding and get started
- Bindings overview — bindings across Telnyx API, Secrets, KV, and Cloud Storage
- S3-compatible API reference — the same buckets over HTTP