Lua
Lua
Example: Http.S3_FileExists method
Demonstrates theS3_FileExists method.
Chilkat Lua Downloads
local chilkat = require("chilkat")
local http = chilkat.Http.new()
-- Insert your AWS keys here:
http.aws_access_key = "AWS_ACCESS_KEY"
http.aws_secret_key = "AWS_SECRET_KEY"
local bucketName = "chilkat.ocean"
local objectName = "seahorse.jpg"
http.aws_region = "us-west-2"
http.aws_endpoint = "s3-us-west-2.amazonaws.com"
local retval = http:s3_file_exists(bucketName, objectName)
if retval < 0 then
print("Failed to check for the S3 object existence")
print(http.last_error_text)
return
end
if retval == 0 then
print("The S3 object does not exist.")
return
end
print("The S3 object exists.")