GithubHelp home page GithubHelp logo

berwin / aliyun-oss-upload-stream Goto Github PK

View Code? Open in Web Editor NEW
151.0 10.0 12.0 41 KB

A Node.js module for streaming data to Aliyun oss via the multipart upload API

License: MIT License

JavaScript 100.00%
aliyun-oss stream

aliyun-oss-upload-stream's Introduction

aliyun-oss-upload-stream

NPM Version NPM Downloads

Aliyun oss 的 Multipart upload API 实现的Node.js模块,通过stream的方式上传文件。

官方指定Nodejs模块~

为什么使用stream?

  • 使用stream的方式上传文件可以很大程度上降低服务器内存开销。Aliyun官方SDK并没有对stream进行一个完美的封装,所以通常上传文件(Put Object)的流程是客户端上传文件到服务器,服务器把文件数据缓存到内存,等文件全部上传完毕后,一次性上传到Aliyun Oss服务。这样做一旦瞬间上传文件的请求过多,服务器的内存开销会直线上升。而使用stream的方式上传文件的流程是客户端在上传文件数据到服务器的过程中,服务器同时也在把文件数据往Aliyun Oss服务传送,而不需要在服务器上缓存文件数据。
  • 可以上传大文件,根据上传数据方式不同而不同, Put Object 方式 文件最大不能超过 5GB,而使用stream的方式,文件大小不能超过 48.8TB
  • 更快的速度,由于传统方式(Put Object方式)是客户端上传完毕文件后,统一上传到Aliyun Oss,而stream的方式基本上客户端上传完毕后,服务器已经把一大半的文件数据上传到Aliyun了,所以速度要快很多
  • 使用更简单,经过封装后,stream的方式使用起来非常的方便,1分钟就可以学会如何使用

例子

var ALY = require('aliyun-sdk'),
  fs = require('fs');

var ossStream = require('aliyun-oss-upload-stream')(new ALY.OSS({
  accessKeyId: '在阿里云OSS申请的 accessKeyId',
  secretAccessKey: '在阿里云OSS申请的 secretAccessKey',
  endpoint: 'http://oss-cn-hangzhou.aliyuncs.com',
  apiVersion: '2013-10-15'
}));

var upload = ossStream.upload({
  Bucket: 'Bucket',
  Key: 'Key (可以理解为文件名)'
});

// 可选配置
upload.minPartSize(1048576); // 1M,表示每块part大小至少大于1M

upload.on('error', function (error) {
  console.log('error:', error);
});

upload.on('part', function (part) {
  console.log('part:', part);
});

upload.on('uploaded', function (details) {
  var s = (new Date() - startTime) / 1000;
  console.log('details:', details);
  console.log('Completed upload in %d seconds', s);
});

var read = fs.createReadStream('./photo.jpg');
read.pipe(upload);

var startTime = new Date();

使用

初始化

var ALY = require('aliyun-sdk');

var ossStream = require('aliyun-oss-upload-stream')(new ALY.OSS({
  accessKeyId: '在阿里云OSS申请的 accessKeyId',
  secretAccessKey: '在阿里云OSS申请的 secretAccessKey',
  endpoint: 'http://oss-cn-hangzhou.aliyuncs.com',
  apiVersion: '2013-10-15'
}));

上传文件

var upload = ossStream.upload({
  Bucket: 'Bucket-Name',
  Key: 'Key-Name'
});

var read = fs.createReadStream('./photo.jpg');
read.pipe(upload);

操作方法

upload.minPartSize

用于调整每次上传一小块数据的大小,不得低于200KB,默认为200KB,如果经常上传大文件,建议用此方法把值调整大一些

var upload = ossStream.upload({
  Bucket: 'Bucket-Name',
  Key: 'Key-Name'
});

// 可选配置
upload.minPartSize(1048576); // 1M,表示每块part大小至少大于1M

var read = fs.createReadStream('./photo.jpg');
read.pipe(upload);

事件

error

当上传过程中发生错误,触发error事件,回调函数参数为错误信息

upload.on('error', function (error) {
  console.log('error:', error);
});

part

上传文件的过程中,会触发part事件,回调函数参数为当前分片的信息

upload.on('part', function (part) {
  console.log('part:', part);
});

uploaded

上传成功后触发该事件,回调函数参数为完整的 Object

upload.on('uploaded', function (details) {
  console.log('details:', details);
});

安装

npm i --save aliyun-oss-upload-stream

PS: 如果大家使用过程中,发现什么问题或者需要添加什么功能,及时通知我哈~ 我会及时更新和发布新版本~

The MIT License (MIT)

Copyright (c) 2015 Berwin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

aliyun-oss-upload-stream's People

Contributors

berwin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aliyun-oss-upload-stream's Issues

字符串stream化上传错误

node -v
v1.12.5

"dependencies": {
"aliyun-oss-upload-stream": "^1.2.3",
"aliyun-sdk":"^1.7.8",
"sqlite3": "^3.1.0",
"winston": "^2.2.0",
"iconv-lite":"^0.4.12",
"url":"^0.10.3"
},
字符串string化上传.

try{
                var s = new stream.Readable();//"this is test";
                s._read = function noop(){};
                s.push(content);
                s.push(null);
                s.pipe(upload);

            }

part 和uploaded事件依次触发,但随即报以下错误:

if (this._hardError) throw err;
^
200: null
at Request.extractError (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/services/oss.js:151:37)
at Request.callListeners (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/sequential_executor.js:113:20)
at Request.callListeners (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/sequential_executor.js:114:16)
at Request.emit (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/sequential_executor.js:81:10)
at Request.emit (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/request.js:389:14)
at Request.transition (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/request.js:52:12)
at AcceptorStateMachine.runTo (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/request.js:17:12)
at /home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/request.js:29:10
at Request.transition (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/request.js:66:7)
at AcceptorStateMachine.runTo (/home/xingchch/homepage/parser/node_modules/aliyun-sdk/lib/request.js:17:12)

The Content-MD5 you specified was invalid

When upload a png file, I got the following error:

message: 'The Content-MD5 you specified was invalid.',
code: 'InvalidDigest',
headers:
{ server: 'AliyunOSS',
date: 'Tue, 16 Jan 2018 15:26:20 GMT',
'content-type': 'application/xml',
'content-length': '318',
connection: 'close',
'x-oss-request-id': '5A5E1990952383AD27B700B9',
'x-oss-server-time': '46' },
time: 2018-01-16T15:26:20.277Z,
statusCode: 400,
retryable: false }

Cannot read property 'Bucket' of null

正常情况下都不会出现这个错误,但是偶尔出出现以下错误. 并且这个错误也无法捕获, 直接导致node server 死机.

/data/www/parser/node_modules/aliyun-sdk/lib/request.js:99
if (this._hardError) throw err;
                                 ^
TypeError: Cannot read property 'Bucket' of null
    at abortUpload (/data/www/parser/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:176:36)
    at Response.<anonymous> (/data/www/parser/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:83:23)
    at Request.<anonymous> (/data/www/parser/node_modules/aliyun-sdk/lib/request.js:163:20)
    at Request.callListeners (/data/www/parser/node_modules/aliyun-sdk/lib/sequential_executor.js:113:20)
    at Request.emit (/data/www/parser/node_modules/aliyun-sdk/lib/sequential_executor.js:81:10)
    at Request.emit (/data/www/parser/node_modules/aliyun-sdk/lib/request.js:389:14)
    at Request.transition (/data/www/parser/node_modules/aliyun-sdk/lib/request.js:52:12)
    at AcceptorStateMachine.runTo (/data/www/parser/node_modules/aliyun-sdk/lib/request.js:17:12)
    at /data/www/parser/node_modules/aliyun-sdk/lib/request.js:29:10
    at Request.transition (/data/www/parser/node_modules/aliyun-sdk/lib/request.js:66:7)

参数不全

   // 初始化MultipartUpload
  createMultipartUpload({
    Bucket: destinationDetails.Bucket,
    Key: destinationDetails.Key
  });

只支持两个参数,建议能传入其他的参数,如:

  oss.createMultipartUpload({
  ACL: 'public-read',
  Bucket: bucket,
  Key: fileKey,
  ContentType: 'audio/mpeg',
  ContentDisposition: ''
  //CacheControl: '',
  //ContentEncoding: '',
  //Expires: '',
  //ServerSideEncryption: ''
})

上传一个7.3G的文件出现如下错误

使用readme中的代码进行上传的,结果报错,是不是分片数量太多造成的。
error: { [InvalidArgument: Part number must be an integer between 1 and 10000, inclusive.]
message: 'Part number must be an integer between 1 and 10000, inclusive.',
code: 'InvalidArgument',
headers:
{ server: 'AliyunOSS',
date: 'Mon, 19 Sep 2016 03:09:04 GMT',
'content-type': 'application/xml',
'content-length': '374',
connection: 'close',
'x-oss-request-id': '57DF56D0D3A24AE1368F0869',
'x-oss-server-time': '0' },
time: Mon Sep 19 2016 11:09:04 GMT+0800 (CST),
statusCode: 400,
retryable: false }

上传大文件时出现NetworkingError: read ETIMEDOUT

Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: Error: Uncaught, unspecified "error" event. (NetworkingError: read ETIMEDOUT
Additionally failed to abort the multipart upload on OSS: 204: null))))))))))))))))))))))))))))))))))))))))))))))))
at Writable.emit (events.js:164:17)
at Response. (/data/fe.appbuilder/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:250:12)
at Request. (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:163:20)
at Request.callListeners (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/sequential_executor.js:113:20)
at Request.emit (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/sequential_executor.js:81:10)
at Request.emit (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:389:14)
at Request.transition (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:52:12)
at AcceptorStateMachine.runTo (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:17:12)
at /data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:29:10
at Request.transition (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:66:7)
at AcceptorStateMachine.runTo (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:17:12)
at /data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:29:10
at Request.transition (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:66:7)
at AcceptorStateMachine.runTo (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:17:12)
at /data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:29:10
at Request.transition (/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:66:7)
/data/fe.appbuilder/node_modules/aliyun-sdk/lib/request.js:99
if (this._hardError) throw err;

上传较大文件报错

环境:
mac上部署,windows上访问并上传文件,使用的是项目中得例子。文件大小为50M左右,小文件倒是可以上传。
问题:报错很多:part过小或链接错误。
另外,建议:上传过程中能否只报一次错误?

cacheClient.createMultipartUpload error

TypeError: Object [object Object] has no method 'createMultipartUpload'
    at createMultipartUpload (/Users/huangjiangtao/Places/Code/oss-upload/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:80:18)
    at Writable.ws._write (/Users/huangjiangtao/Places/Code/oss-upload/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:61:7)
    at doWrite (_stream_writable.js:226:10)
    at writeOrBuffer (_stream_writable.js:216:5)
    at Writable.write (_stream_writable.js:183:11)
    at write (_stream_readable.js:602:24)
    at flow (_stream_readable.js:611:7)
    at ReadStream.pipeOnReadable (_stream_readable.js:643:5)
    at ReadStream.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:427:10)

有一个问题,我在用nodejs上传的时候,cachedClient.createMultipartUpload报没有此方法

这是后台报错信息,代码就是拷贝你的,该怎么破!
/root/shield/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:144
cachedClient.createMultipartUpload(details, function (err, data) {
^

TypeError: cachedClient.createMultipartUpload is not a function
at createMultipartUpload (/root/shield/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:144:18)
at Writable.ws._write (/root/shield/node_modules/aliyun-oss-upload-stream/lib/aliyun-oss-upload-stream.js:115:7)
at doWrite (_stream_writable.js:371:12)
at writeOrBuffer (_stream_writable.js:357:5)
at Writable.write (_stream_writable.js:274:11)
at PNGStream.ondata (internal/streams/legacy.js:16:26)
at emitTwo (events.js:125:13)
at PNGStream.emit (events.js:213:7)
at /root/shield/node_modules/canvas/lib/pngstream.js:48:14
at /root/shield/node_modules/canvas/lib/pngstream.js:43:19
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickDomainCallback (internal/process/next_tick.js:198:9)

EntityTooSmall

错误提示:

sails-web-0 正在下载http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg
sails-web-0 part: { ETag: '"41AF038F89BBA8572CD8DCCF83A9129B"', PartNumber: 1 }
sails-web-0 part: { ETag: '"E793CFBDF6EA28FF70952A8C4CCD3DD5"', PartNumber: 2 }
sails-web-0 part: { ETag: '"A1AE3E3D09228480AC8866DF937CD762"', PartNumber: 3 }
sails-web-0 part: { ETag: '"8948C1FB4823E6AD013414EAF902EC20"', PartNumber: 6 }
sails-web-0 part: { ETag: '"73B3733FED139414D4B783562E23DD92"', PartNumber: 5 }
sails-web-0 part: { ETag: '"47DE8749328ABF652E6D9795533BE447"', PartNumber: 7 }
sails-web-0 part: { ETag: '"8D3248FD8B35BC11BD61AD65C618A0AD"', PartNumber: 4 }
sails-web-0 oss上传出错: { [EntityTooSmall: Your proposed upload smaller than the minimum allowed size.]
sails-web-0   message: 'Your proposed upload smaller than the minimum allowed size.',
sails-web-0   code: 'EntityTooSmall',
sails-web-0   headers: 
sails-web-0    { server: 'AliyunOSS',
sails-web-0      date: 'Thu, 25 Aug 2016 07:44:14 GMT',
sails-web-0      'content-type': 'application/xml',
sails-web-0      'content-length': '498',
sails-web-0      connection: 'close',
sails-web-0      'x-oss-request-id': '57BEA1CE8B99589B46A4F6B8',
sails-web-0      'x-oss-server-time': '16' },
sails-web-0   time: Thu Aug 25 2016 15:44:14 GMT+0800 (CST),
sails-web-0   statusCode: 400,
sails-web-0   retryable: false }

使用版本:1.2.3
场景:
顺序下载微信某文章里面的图片并上传到oss,大概的逻辑如下:

var imgArr = [
'http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg',
'http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg',
'http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg',
'http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg',
'http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg',
'http://mmbiz.qpic.cn/mmbiz_jpg/3IsQywSTDe9FDDT6wFicelfUHRogZGKbibLb4papypVHrlaE7ajqic5ibgb6vCpJ50axYXMkqxPhPsCCCM2dd7o8bg/0?wx_fmt=jpeg'
];

async.mapSeries(imgArr,function(item,callback){
     request(item).pipe(upload);
     upload.on('uploaded',function(details){
        callback(null,details);
     })
},function(err,results){...})

看到之前有提到 #11
不过我的场景还是会报错,本地成功率高一些,阿里云上90%以上会报错

提工单问过阿里云技术支持:
问: 如果实体的大小本来就小于100k,使用分块上传会不会有问题?
答: 您好,会有问题的,谢谢

请问作者是否有啥解决办法?
如需提供更多细节可以联系我,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.