【发布时间】:2017-08-31 00:32:40
【问题描述】:
我正在尝试从 s3 存储桶下载视频文件并将其显示在我的 angularjs 应用程序中。我正在尝试使用 AWS Node.js 来做到这一点,但无法做到。请帮帮我
示例代码
var AWS = require('aws-sdk');
AWS.config.update(
{
accessKeyId: ".. your key ..",
secretAccessKey: ".. your secret key ..",
}
);
var s3 = new AWS.S3();
s3.getObject(
{ Bucket: "my-bucket", Key: "path/to/videofile" },
function (error, data) {
if (error != null) {
alert("Failed to retrieve an object: " + error);
} else {
alert("Loaded " + data.ContentLength + " bytes");
// do something with data.Body
}
}
);
我可以获取数据但不知道如何显示,数据是一个对象
【问题讨论】:
标签: angularjs aws-sdk-js