s3Read

Reads an object from an S3 (or S3-compatible) bucket and returns its body as a UTF-8 string.

s3Read(bucket, object [, charset, accessKeyId, secretKey, host]) → returns string

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

Argument Reference

bucket string
Required

The name of the S3 bucket to read from.

object string
Required

The object key to read.

charset string

Character encoding to use when decoding the body (informational; bodies are decoded as UTF-8).

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 s3Read function

Reads the body of an object from a bucket.

content = s3Read("my-bucket", "logs/today.txt");

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

Fork me on GitHub