Created
February 11, 2017 16:56
-
-
Save Feawel/197959518f60c29f81646254ed152814 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 writeAudioStreamToS3 = ( audioStream, filename ) => | |
putObject(aws_publicBucket, filename, audioStream,'audio/mp3').then( res => { | |
if(!res.ETag) throw res | |
else return { | |
msg: 'File successfully generated.', | |
ETag: res.ETag, | |
url: `https://s3-eu-west-1.amazonaws.com/${aws_publicBucket}/${filename}` | |
} | |
}) | |
const putObject = (bucket, key, body, ContentType) => | |
s3.putObject({ | |
Bucket: bucket, | |
Key: key, | |
Body: body, | |
ContentType | |
}).promise() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment