Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node download s3 file

const AWS = require('aws-sdk');
AWS.config.update(
  {
    accessKeyId: "....",
    secretAccessKey: "...",
    region: 'ap-southeast-1'
  }
);
const s3 = new AWS.S3();
const options = {
  Bucket    : '/bucket-url',
  Key    : fileKey,
};
const fileStream = s3.getObject(options).createReadStream();
fileStream.pipe(res);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #node #download #file
ADD COMMENT
Topic
Name
7+9 =