Downloads an object from an S3 bucket. It can save the object to a file, pass it to a function in parts, or return its content.
s3Download(bucketName, objectName [, target, charset, accessKeyId, secretAccessKey, host, timeout])
→ returns any
fileOpen(path, "write"), or a function that receives the data in parts. The function's argument name sets how the data is split: line, string{size} or binary{size}. Return false from it to stop. When omitted, the content is returned.
lucee.s3.accesskeyid system property or environment variable.
lucee.s3.secretaccesskey system property or environment variable.
https://. Defaults to Amazon AWS.
10000bucket and object, and the secret key argument secretKey. target is a file path, and the function returns true when it saves to a file. Doesn't list timeout.
Writes the object to the file.
s3Download("my-bucket", "logs/today.txt", fileOpen(expandPath("./today.txt"), "write"));
Without a target, the content is returned.
content = s3Download("my-bucket", "logs/today.txt");
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.