📜  节点下载 s3 文件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:44.133000             🧑  作者: Mango

代码示例1
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);