2
更新:在向该用户添加完整访问策略权限后,它从commandline开始工作。现在当我用Node来做时,没有错误,但是我看不到s3文件管理器中的文件。Amazon S3 EPIPE错误
我不断收到使用亚马逊S3服务的EPIPE错误。
我有点卡住,不确定如何继续。
我正在使用Node.js和Knox module。
这里是我的代码:
var client = knox.createClient({
key: amazonAccessKeyId,
secret: amazonSecretAccessKey,
bucket: amazonBucketName
});
function moveFiles() {
moveUploadedFile(req.files['aps-file'].path,'/aps-products.csv', this.parallel());
moveUploadedFile(req.files['perry-craft-roof-file'].path,'/perry-craft-roof-products.csv', this.parallel());
res.end('successful!');
}
function moveUploadedFile(srcPath, dstPath, callback) {
client.putFile(srcPath, dstPath, { 'x-amz-acl': 'public' }, function (err) {
if (err) {
callback(new Error("Error uploading file for " + dstPath + ": " + err.message), srcPath);
console.log(err);
return;
}
console.log('Finished writing file ' + dstPath + ' to Amazon S3 Cloud');
callback(null, srcPath);
});
}