Created
November 29, 2019 23:24
-
-
Save oismaelash/d77874fea41bc9a1829f76625631f9cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
var s3 = new AWS.S3(); | |
exports.handler = (event, context, callback) => { | |
var params = { | |
"Body": event.base64, | |
"Bucket": "my-bucket", | |
"Key": 'filename.jpeg', | |
"ACL": 'public-read', | |
"ContentType": 'image/jpeg' | |
}; | |
s3.upload(params, function(err, data){ | |
if(err) { | |
callback(err, null); | |
} else { | |
callback(null, data); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment