MCPcopy Index your code
hub / github.com/scality/cloudserver / checkGetObjectPart

Function checkGetObjectPart

tests/functional/aws-node-sdk/test/object/get.js:90–106  ·  view source on GitHub ↗
(key, partNumber, len, body, cb)

Source from the content-addressed store, hash-verified

88 const requestGetPromise = promisify(requestGet);
89
90 function checkGetObjectPart(key, partNumber, len, body, cb) {
91 s3.send(new GetObjectCommand({
92 Bucket: bucketName,
93 Key: key,
94 PartNumber: partNumber,
95 })).then(async data => {
96 checkIntegerHeader(data.ContentLength, len);
97 const md5Hash = crypto.createHash('md5');
98 const md5HashExpected = crypto.createHash('md5');
99 const bodyText = await data.Body.transformToString();
100 assert.strictEqual(
101 md5Hash.update(bodyText).digest('hex'),
102 md5HashExpected.update(body).digest('hex')
103 );
104 return cb();
105 }).catch(cb);
106 }
107
108 // Upload parts with the given partNumbers array and complete MPU.
109 function completeMPU(partNumbers, cb) {

Callers 1

get.jsFile · 0.85

Calls 2

checkIntegerHeaderFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected