s3Write

Writes a value (string, binary or scalar) to an object in an S3 (or S3-compatible) bucket. The MIME type is auto-detected from the object key extension when not supplied explicitly.

s3Write(bucket, object, value [, charset, mimeType, acl, location, accessKeyId, secretKey, host]) → returns void

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

bucket string
Required

The name of the S3 bucket to write to.

object string
Required

The object key to write.

value any
Required

The data to write: a string (encoded as bytes), a binary value, or a scalar (stringified).

charset string

Character encoding used when encoding string data (defaults to UTF-8).

mimeType string

Content-Type header for the object. When omitted, it is guessed from the object key extension.

acl string

Object ACL to apply (accepted for compatibility; not enforced).

location string

Bucket location/region (accepted for compatibility).

accessKeyId string

Inline AWS access key id. Overrides credentials from Application.cfc and environment variables.

secretKey string

Inline AWS secret access key.

host string

Inline endpoint URL for S3-compatible providers (e.g. Cloudflare R2, MinIO).

Examples
Sample code invoking the s3Write function

Stores a text value under the given key.

s3Write("my-bucket", "logs/today.txt", "hello world");

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub