我使用這個模塊上傳文件到AmazonAWS上傳文件超過5MB -
https://www.npmjs.com/package/streaming-s3,這是工作的罰款,如果文件大於5 MB小於或等於。
我試圖上傳大小爲6 MB的PDF文件。它顯示上傳成功,但當我試圖通過aws打開該文件。
它示出失敗當我在AWS檢查大小它顯示5 MB加載PDF文檔
。
我使用下面的代碼在AWS上
var options = {
concurrentParts: 2,
waitTime: 20000,
retries: 2,
maxPartSize: 10 * 1024 * 1024
};
//call stream function to upload the file to s3
var uploader = new streamingS3(fileReadStream, config.aws.accessKey, config.aws.secretKey, awsHeader, options);
//start uploading
uploader.begin();// important if callback not provided.
// handle these functions
uploader.on('data', function (bytesRead) {
console.log(bytesRead, ' bytes read.');
});
uploader.on('part', function (number) {
console.log('Part ', number, ' uploaded.');
});
// All parts uploaded, but upload not yet acknowledged.
uploader.on('uploaded', function (stats) {
console.log('Upload stats: ', stats);
});
uploader.on('finished', function (response, stats) {
console.log(response);
logger.log('info', "UPLOAD ", response);
cb(null, response);
});
uploader.on('error', function (err) {
console.log('Upload error: ', err);
logger.log('error', "UPLOAD Error: ", err);
cb(err);
});
這是不到5個MB的文件工作正常上傳。
有什麼想法?是否有我需要在AWS上做的任何設置?
感謝
你在控制檯中得到了什麼?你爲什麼改變maxPartSize? – Mircea
上傳數據:{downloadSpeed:5242880000, uploadSpeed:66365570, downloadTime:1, uploadTime:79, 大小:5242880} 沒有錯誤 –
你看到完成的消息? – Mircea