我一直试图让这个非常精细的Uploader (刚从NPM-5.12.0-alpha)建立起来,将一些数据推送到S3,而且我在分块方面遇到了一些问题。基于并发春景的示例,我已经启用了分块,但我没有看到多个块被上传到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
从本质上说,我看到了选项请求,这很好,上传正确启动,但我只看到一个出站连接-内容类型不是我所期望的,它是多部分的形式,而不是原始的。虽然我的预期可能是错误的,但我本以为它只是一个原始的垃圾桶。
如有任何建议,将不胜感激。
发布于 2016-10-21 17:06:45
您的选项没有正确设置,这就是并发块未启用的原因。
您在chunking部分中定义了callbacks选项。将其移出callbacks (以及maxConnections和retry)。
https://stackoverflow.com/questions/40165811
复制相似问题