Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

aws s3 javascript example

const AWS = require('aws-sdk')

const s3Params = {
  Bucket: process.env.AWS_S3_BUCKET
}

const s3 = AWS.S3({
  accessKeyId: process.env.AWSAccessKeyId as string,
  secretAccessKey: process.env.AWSSecretKey as string,
  params: {
    ...s3Params
  }
})

s3.upload({
	Body: file, // Buffer
	Key: ' path/to/file.png'
}, (err, data) => { // Finished })
 
PREVIOUS NEXT
Tagged: #aws #javascript
ADD COMMENT
Topic
Name
9+7 =