Last active
January 9, 2019 09:48
-
-
Save batrudinych/36d485cceccf1fdbad56828f2e17d6f6 to your computer and use it in GitHub Desktop.
[s3-redeploy]-sequential-files-uploading
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 fs = require('fs'); | |
const aws = require('aws-sdk'); | |
const s3Client = new aws.S3(); | |
async function uploadFilesToS3(fileNames) { | |
for (const fileName of fileNames) { | |
const fileStream = fs.createReadStream(fileName); | |
await s3Client.upload({ | |
Key: fileName, | |
Body: fileStream, | |
}).promise(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment