📢 Registration + agenda now live
Explore the latest Grafana Cloud and AI solutions, learn tips & tricks from demos and hands-on workshops, and get actionable advice to advance your observability strategy. Register now and get 50% off - limited tickets available (while they last!).
S3UploadedObject represents the response returned by S3 upload operations such as
putObject and
completeMultipartUpload. It contains metadata about the uploaded object, including checksums and upload verification information.
Properties
Name
Type
Description
eTag
string
The entity tag (ETag) of the uploaded object. This is a hash of the object that can be used to verify the integrity of the uploaded data.
crc32
string (optional)
The base64-encoded CRC32 checksum of the uploaded object, if available.
crc32c
string (optional)
The base64-encoded CRC32C checksum of the uploaded object, if available.
crc64nvme
string (optional)
The base64-encoded CRC64NVME checksum of the uploaded object, if available.
sha1
string (optional)
The base64-encoded SHA1 checksum of the uploaded object, if available.
sha256
string (optional)
The base64-encoded SHA256 checksum of the uploaded object, if available.
checksumType
string (optional)
The type of checksum algorithm used. Can be “COMPOSITE” for multipart uploads or “FULL_OBJECT” for single-part uploads.
size
number (optional)
The size of the uploaded object in bytes, if available.
Example
JavaScript
import{
AWSConfig,
S3Client,}from'https://jslib.k6.io/aws/0.14.0/s3.js';const awsConfig =newAWSConfig({region: __ENV.AWS_REGION,accessKeyId: __ENV.AWS_ACCESS_KEY_ID,secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,});const s3 =newS3Client(awsConfig);const testBucketName ='test-jslib-aws';const testFileKey ='test-file.txt';exportdefaultasyncfunction(){const testData ='Hello, World!';// Upload the object and get the upload responseconst uploadResult =await s3.putObject(testBucketName, testFileKey, testData);// Access the upload metadata
console.log('Upload ETag:', uploadResult.eTag);
console.log('Object size:', uploadResult.size);// Check if checksums are availableif(uploadResult.sha256){
console.log('SHA256 checksum:', uploadResult.sha256);}if(uploadResult.checksumType){
console.log('Checksum type:', uploadResult.checksumType);}// Verify the upload was successfulif(uploadResult.eTag){
console.log('Upload successful, ETag received:', uploadResult.eTag);}}
Usage in Multipart Uploads
For multipart uploads, the S3UploadedObject is returned by the completeMultipartUpload method: