Commit 8156cd54 by Pragati Upadhyay

conTentType

parent 063cd85e
...@@ -13,7 +13,8 @@ const s3 = new AWS.S3({ ...@@ -13,7 +13,8 @@ const s3 = new AWS.S3({
region: CONFIG.S3_REGION, region: CONFIG.S3_REGION,
}) })
module.exports.uploadToAwsS3 = async function (localPath, remotePath, options) { module.exports.uploadToAwsS3 = async function (localPath, remotePath,contentType,options) {
console.log("🚀 ~ contentType:", contentType)
console.log("🚀 ~ options:", options) console.log("🚀 ~ options:", options)
const buffer = Fs.readFileSync(localPath); const buffer = Fs.readFileSync(localPath);
...@@ -25,12 +26,12 @@ console.log("🚀 ~ options:", options) ...@@ -25,12 +26,12 @@ console.log("🚀 ~ options:", options)
Bucket: CONFIG.S3_BUCKET_NAME, Bucket: CONFIG.S3_BUCKET_NAME,
Key: remotePath, Key: remotePath,
}; };
if(options.contentType){ if(contentType.contentType){
params.contentType = options.contentType params.contentType = contentType.contentType
} }
s3.putObject(params, function (err, data) { s3.putObject(params, function (err, data) {
if (err) { if (err) {
errorLog.error(err, `Exception handling error on uploadToAwsS3`); console.log(err);
} }
// successful response // successful response
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment