s3GetMetaData

Returns the metadata of an S3 bucket or object.

s3GetMetaData(bucketNameOrPath [, objectName, accessKeyId, secretAccessKey, host, timeout]) → returns struct

Argument Reference

bucketNameOrPath string
Required

The bucket name, or an s3:// path to a bucket or object, such as s3://mybucket/file.txt.

objectName string

The object key, when bucketNameOrPath is a bucket name.

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 two arguments bucket and object, and the secret key argument secretKey. Returns content_type, content_length, etag, last_modified, storage_class and any x-amz-meta-* headers. Doesn't list timeout.

Examples
Sample code invoking the s3GetMetaData function

Returns a struct with the object's metadata.

meta = s3GetMetaData("my-bucket", "logs/today.txt");

Passing an s3:// URL as the first argument addresses the object directly.

meta = s3GetMetaData("s3://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