in awsio/csrc/io/s3/s3_io.cpp [366:379]
size_t S3Init::get_file_size(const std::string &bucket,
const std::string &object) {
Aws::S3::Model::HeadObjectRequest headObjectRequest;
headObjectRequest.WithBucket(bucket.c_str()).WithKey(object.c_str());
auto headObjectOutcome =
this->initializeS3Client()->HeadObject(headObjectRequest);
if (headObjectOutcome.IsSuccess()) {
return headObjectOutcome.GetResult().GetContentLength();
}
Aws::String const &error_aws = headObjectOutcome.GetError().GetMessage();
std::string error_str(error_aws.c_str(), error_aws.size());
throw std::invalid_argument(error_str);
return 0;
}