AWS-SDK-CPP:传输管理器文件下载崩溃
AWS-SDK-CPP: Transfer Manager file download crashes
以下用 C++ 编写的代码在 Visual Studio 2015 年崩溃。我将 v 1.1.1
用于 AWSSDKCPP-Trasnfer
到 NuGet
。我无法在网上找到任何示例代码,也找不到有关将传输管理器与 C++ SDK 一起使用的适当文档。如果我有错误请指出。
// download a single file from aws s3 bucket
// use transfer manager
// assume Aws::InitAPI() has already been called
int downloadFile(const Aws::String &bucketName, const Aws::String &objectKey) {
auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(S3_CLIENT_TAG);
TransferManagerConfiguration transferConfig;
transferConfig.s3Client = s3Client;
// lambda for download progress callback
transferConfig.downloadProgressCallback =
[](const TransferManager*, const TransferHandle& handle)
{ std::cout << handle.IsMultipart() << std::endl; };
// the fabled transfer manager
TransferManager transferManager(transferConfig);
auto transferHandle = transferManager.DownloadFile(bucketName, "sample.txt", "sample.txt");
transferHandle->WaitUntilFinished(); // block calling thread until download complete
return 0;
}
不,你没有看错。这是一个issue #574。正在修复中。应该很快就会发布。
以下用 C++ 编写的代码在 Visual Studio 2015 年崩溃。我将 v 1.1.1
用于 AWSSDKCPP-Trasnfer
到 NuGet
。我无法在网上找到任何示例代码,也找不到有关将传输管理器与 C++ SDK 一起使用的适当文档。如果我有错误请指出。
// download a single file from aws s3 bucket
// use transfer manager
// assume Aws::InitAPI() has already been called
int downloadFile(const Aws::String &bucketName, const Aws::String &objectKey) {
auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(S3_CLIENT_TAG);
TransferManagerConfiguration transferConfig;
transferConfig.s3Client = s3Client;
// lambda for download progress callback
transferConfig.downloadProgressCallback =
[](const TransferManager*, const TransferHandle& handle)
{ std::cout << handle.IsMultipart() << std::endl; };
// the fabled transfer manager
TransferManager transferManager(transferConfig);
auto transferHandle = transferManager.DownloadFile(bucketName, "sample.txt", "sample.txt");
transferHandle->WaitUntilFinished(); // block calling thread until download complete
return 0;
}
不,你没有看错。这是一个issue #574。正在修复中。应该很快就会发布。