s3ListBucket

Lists the objects in an S3 bucket, as a query.

s3ListBucket(bucketName [, listener, blockfactor, accessKeyId, secretAccessKey, host, timeout]) → returns query

Argument Reference

bucketName string
Required

The bucket name.

listener any

A function or component that receives the listed objects.

blockfactor numeric
Default: 1000

The number of objects to fetch per request.

accessKeyId string

The S3 access key ID. Defaults to the lucee.s3.accesskeyid system property or environment variable.

secretAccessKey string

The S3 secret access key. Defaults to the lucee.s3.secretaccesskey system property or environment variable.

host string

The hostname of an S3-compatible provider, without https://. Defaults to Amazon AWS.

timeout numeric
Default: 10000

The timeout in milliseconds.

Compatibility

Lucee:

Requires the S3 extension.

RustCFML:

Names the first argument bucket and the secret key argument secretKey. Takes prefix and maxKeys as the second and third arguments instead of listener and blockfactor, and returns an array of structs with key, size, lastModified, eTag, storageClass and isDirectory. Doesn't list timeout.

Examples
Sample code invoking the s3ListBucket function

Returns a query of the bucket's objects.

listing = s3ListBucket("my-bucket");

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

Fork me on GitHub