我想从s3桶下载视频文件并在我的angularjs应用程序中显示它。我正在尝试使用AWS Node.js,但无法做到这一点。请帮我Angularjs下载一个私人视频文件,并从s3桶播放
示例代码
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
}
}
);
我能够得到的数据,但不知道如何表达,数据是一个对象