我正在尝试从 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
}
}
);
我能够获取数据但不知道如何显示它,数据是一个对象