お世話になります。
Node.jsに送られてきたメールを解析して添付ファイルをS3に格納したいのですが、
バイナリ指定しても、何も指定しなくてもファイルが破損してしまい、解凍できなくなってしまいます。
binaryじゃなくて何を指定すればいいのか、どなたかご教授願います。
node.js
1app.post('/inbound', function (req, res) { 2 if (req.body.Attachments.length == 0) { res.send('success') } 3 var from = req.body.From, 4 messageId = req.body.MessageID, 5 s3bucket = new aws.S3({ params: { Bucket: 'hoge' } }); 6 7 req.body.Attachments.forEach(function (attachment) { 8 s3bucket.putObject({ 9 Key: 'piyo/' + attachment.Name, 10 Body: new Buffer(attachment.Content, 'binary') 11 //Body: attachment.Content でもダメでした 12 13 }, function (err, data) { 14 if (err) { console.error(err) } 15 res.send('success'); 16 }); 17 }); 18}); 19
よろしくお願いいたします。