async
(params, auths) => {
}
const { fileUrl, s3Bucket, s3Key } = params
const { accessKeyId, secretAccessKey } = auths.aws
const AWS = require("aws-sdk")
const s3 = new AWS.S3({ accessKeyId, secretAccessKey })
const urlResponse = await require("axios").get(fileUrl, { responseType: 'stream' })
const s3Response = await s3.upload({
Bucket: s3Bucket,
Key: s3Key,
ContentType: urlResponse.headers['content-type'],
ContentLength: urlResponse.headers['content-length'],
Body: urlResponse.data,
}).promise()
return (await s3Response).Location