【发布时间】:2020-04-06 05:14:38
【问题描述】:
我正在尝试使用从我的 Sagemaker 端点返回的数据将对象放入我的 s3 存储桶中。
<Buffer 50 4b 03 04 14 00 00 00 08 00 6c 83 85 50 2c 2e dd 02 9e 61 93 00 fa 7f a1 00 32 00 00 00 6f 75 74 70 75 74 2f 61 75 64 69 6f 5f 66 69 6c 65 5f 31 35 ... > }
对 s3 的 put 请求运行良好。文件大小符合预期,18mb。但是,当我尝试在浏览器中播放 mp3 链接或下载要播放的文件时,它说文件给了我这个错误:
This file isn't playable. That might be because the file type is unsupported, the file extension is incorrect, or the file is corrupt.
这是我的 putObject 函数:
var params = {
Bucket : 'musicbucket-audio-uploads',
Key : 'test.wav',
Body : data.Body, //This is the Buffer Data
ContentType: 'audio/wav'
};
s3.putObject(params, function(err, data) {
if (err) console.log('PutObject Error: ' + err);
else console.log(data);
});
我认为我在 putObject 的参数中做错了一步,但不确定是什么。有人可以帮我找出我的错误吗?
【问题讨论】:
-
我认为 MP3 内容类型是音频/mpeg,而不是音频/wav。
-
我已尝试将 ContentType 切换为音频/mpeg 并将密钥切换为 .mp3,但由于某种原因该文件仍未播放。难道是我需要对
Body多做一步? -
我检查了 s3 文件的内容类型是否被保存为音频/mpeg,所以现在我真的不知道为什么它不起作用:/
-
SageMaker 模型大概有一些文档或规范。它说明了返回缓冲区的格式是什么?在您了解自己拥有什么之前,将 S3 包含在此对话中似乎毫无意义。
-
不错!我应该已经认出了以 PK 开头的标题。
标签: node.js amazon-web-services amazon-s3 aws-lambda