services/uploads/src/antivirus.js
/**
 * Retrieve the file size of S3 object without downloading.
 * @param {string} key    Key of S3 object
 * @param {string} bucket Bucket of S3 Object
 * @return {int} Length of S3 object in bytes.
 */
Retrieve the file size of S3 object without downloading.
@param {string} key    Key of S3 object
@param {string} bucket Bucket of S3 Object
@return {int} Length of S3 object in bytes.
Retrieve the file size of S3 object without downloading . @param { string } key Key of S3 object @param { string } bucket Bucket of S3 Object @return { int } Length of S3 object in bytes .
async function sizeOf(key, bucket) {
  console.log("key: " + key);
  console.log("bucket: " + bucket);
  var sts = new AWS.STS();
  var params = {};
  let res = await s3.headObject({ Key: key, Bucket: bucket }).promise();
  return res.ContentLength;
}
async function sizeOf ( key , bucket ) { console . log ( "key: " + key ) ; console . log ( "bucket: " + bucket ) ; var sts = new AWS . STS ( ) ; var params = { } ; let res = await s3 . headObject ( { Key : key , Bucket : bucket } ) . promise ( ) ; return res . ContentLength ; }
Retrieve the file size of S3 object without downloading.
Retrieve the file size of S3 object without downloading .