MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / encode

Function encode

examples/s3/main.cpp:86–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86std::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
106std::string download_and_encode_file(
107 Aws::S3::S3Client const& client,

Callers 1

download_and_encode_fileFunction · 0.85

Calls 2

endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected