| 84 | } |
| 85 | |
| 86 | std::string encode(Aws::IOStream& stream, Aws::String& output) |
| 87 | { |
| 88 | Aws::Vector<unsigned char> bits; |
| 89 | bits.reserve(stream.tellp()); |
| 90 | stream.seekg(0, stream.beg); |
| 91 | |
| 92 | char streamBuffer[1024 * 4]; |
| 93 | while (stream.good()) { |
| 94 | stream.read(streamBuffer, sizeof(streamBuffer)); |
| 95 | auto bytesRead = stream.gcount(); |
| 96 | |
| 97 | if (bytesRead > 0) { |
| 98 | bits.insert(bits.end(), (unsigned char*)streamBuffer, (unsigned char*)streamBuffer + bytesRead); |
| 99 | } |
| 100 | } |
| 101 | Aws::Utils::ByteBuffer bb(bits.data(), bits.size()); |
| 102 | output = Aws::Utils::HashingUtils::Base64Encode(bb); |
| 103 | return {}; |
| 104 | } |
| 105 | |
| 106 | std::string download_and_encode_file( |
| 107 | Aws::S3::S3Client const& client, |
no test coverage detected