【发布时间】:2016-10-20 22:57:22
【问题描述】:
我一直在尝试设置这个非常精细的上传器(来自 NPM - 5.12.0-alpha 的新版本)以将一些数据推送到 S3,但我遇到了一些分块问题。根据Concurrent Chunking 的示例,我相信我已经启用了分块,但我没有看到 XHR 控制台中上传了多个块。
const fu = require('fine-uploader/lib/s3');
const SA = require('superagent');
let x = new fu.s3.FineUploaderBasic({
request: {
endpoint: 'they-taken-mah-bucket.s3.amazonaws.com'
},
credentials: {
accessKey: 'invalid',
expiration: new Date(),
secretKey: 'invalid',
sessionToken: 'invalid'
},
objectProperties: {
bucket: 'they-taken-my-bucket',
key: 'filename'
},
autoUpload: false,
debug: true,
callbacks: {
onComplete: function(){
moveUpload({from:'active', to:'finished', hash: activeUpload.hash}).then( function() { good(hash); });
},
onError: function(id, name, reason, xhrCache){
moveUpload({from:'active', to:'error', hash: activeUpload.hash}).then( () => bad(new Error('upload error - '+reason)) );
},
onProgress: function(id, name, uploaded, total){
const elapsed = (Date.now() - t.getTime()) / 1000;
const rate = uploaded / elapsed;
updateUploadProgress({hash: activeUpload.hash, progress: (100*uploaded/total).toFixed(0), rate: rate});
},
chunking: {
enabled: true,
concurrent: {
enabled: true
}
},
maxConnections: 5,
retry: {
enableAuto: true,
maxAutoAttempts: 10
},
onCredentialsExpired: function () {
return fetchCredentials();
}
}
});`
我看到的行为:http://recordit.co/z5VnLR63eT
基本上我看到了 OPTIONS 请求,一切正常,上传正确开始,但我只看到 1 个出站连接 - 内容类型不是我所期望的,它是多部分形式而不是原始形式。虽然也许我的这个期望是错误的,但我原以为它只是一个原始的垃圾邮件。
任何建议将不胜感激。
【问题讨论】:
-
文件有多大?你只提交一个文件吗?
-
啊抱歉,我以为我附上了那个截图。是的,它只有 1 个文件,大小为 54MB。我希望默认部分大小约为 5MB(根据 S3 文档),它会将其分成 10 个块并同时上传 3 个(maxConnections)。