我正在用灰尘将图像上传到我的S3存储桶,该节点没有给我任何错误,图像也没有上传
const uploadFile = () => {
var fileName = req.body;
console.log();
function base64_encode(fileName) {
var bitmap = fs.readFileSync(fileName);
var file = new Buffer(bitmap).toString('base64');
fs.readFile(file, (err, data) => {
if (err) throw err;
const params = {
Bucket: 'My-bucket',
//Key: 'contact.png',
Body: JSON.stringify(file, null, 2)
};
s3.upload(params, function(s3Err, file) {
if (s3Err) throw s3Err
console.log(`File uploaded successfully at ${file.Location}`)
});
});
};
};
uploadFile();