Lua
Lua
Example: Http.S3_DownloadBd method
See more Amazon S3 Examples
Demonstrates theS3_DownloadBd method.
Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
http.aws_access_key = "AWS_ACCESS_KEY"
http.aws_secret_key = "AWS_SECRET_KEY"
http.aws_region = "us-west-2"
http.aws_endpoint = "s3-us-west-2.amazonaws.com"
local bucketName = "chilkat.qa"
local objectName = "/images/sea_creatures/starfish.jpg"
local localFilePath = "qa_output/starfish.jpg"
local bd = chilkat.BinData.new()
local success = http:s3_download_bd(bucketName, objectName, bd)
if not success then
print(http.last_error_text)
return
end
print("Downloaded " .. bd.num_bytes .. " bytes")