我正在尝试使用来自 AWS API 网关的请求通过邮递员使用节点 js lambda 函数将 file(multipart/form-data)上传到 S3 存储桶,但是在 s3.putObject 中传递事件正文时我得到黑色图像。

下面是 Node js 上传文件处理程序。

exports.handler = function (event) {
var bodyBuffer = new Buffer(event['body-json']);
s3.putObject({
        ACL: 'public-read',
        Bucket: BUCKET_NAME + '/' + folderName,
        Key: 'test.jpg',
        Body: bodyBuffer,
        ContentType: 'image/jpg'
    },
    function(error, response) {
        console.log(arguments);
    });
}