Created
March 23, 2020 15:13
-
-
Save jashmenn/ae4fa39a1a35c3b1b5cd5dc07afe64e5 to your computer and use it in GitHub Desktop.
Simple example of uploading to S3 from the filesystem with Node.js - If you're trying to learn how to do this, checkout Fullstack Node.js https://newline.co/fullstack-nodejs
This file contains hidden or 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 { promisify } = require('util') | |
const s3 = new AWS.S3() | |
s3.uploadP = promisify(s3.upload) | |
const params = { | |
Bucket: 'fullstack-printshop', | |
Key: 'profile-photos/thedude.jpg', | |
Body: fs.createReadStream('thedude.jpg') | |
} | |
(async function () { | |
await s3.uploadP(params) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment