Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
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
You can’t perform that action at this time.