s3ListBucket

Lists the objects in an S3 (or S3-compatible) bucket, optionally filtered by a key prefix. Returns an array of structs with key, size, lastModified, eTag, storageClass and isDirectory. If a key prefix is configured for the application, returned keys have the prefix stripped.

s3ListBucket(bucket [, prefix, maxKeys, accessKeyId, secretKey, host]) → returns array

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

Argument Reference

bucket string
Required

The name of the S3 bucket to list.

prefix string

Optional key prefix to filter objects by (e.g. "logs/").

maxKeys numeric

Optional maximum number of keys to return.

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

Returns objects whose keys begin with the prefix.

listing = s3ListBucket("my-bucket", "logs/");

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

Fork me on GitHub