我想從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
}
}
);
我能夠得到的數據,但不知道如何表達,數據是一個對象