Skip to content

Commit

Permalink
修改最大分片大小
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Nov 15, 2018
1 parent e8b1b80 commit d22de28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
12 changes: 7 additions & 5 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,7 @@ var defaultOptions = {
CopyChunkParallelLimit: 20,
CopyChunkSize: 1024 * 1024 * 10,
CopySliceSize: 1024 * 1024 * 10,
MaxPartNumber: 10000,
ProgressInterval: 1000,
UploadQueueSize: 10000,
Domain: '',
Expand All @@ -1962,6 +1963,7 @@ var COS = function (options) {
this.options.CopyChunkParallelLimit = Math.max(1, this.options.CopyChunkParallelLimit);
this.options.CopyChunkSize = Math.max(1024 * 1024, this.options.CopyChunkSize);
this.options.CopySliceSize = Math.max(0, this.options.CopySliceSize);
this.options.MaxPartNumber = Math.max(1024, Math.min(10000, this.options.MaxPartNumber));
if (this.options.AppId) {
console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").');
}
Expand All @@ -1973,7 +1975,7 @@ base.init(COS, task);
advance.init(COS, task);

COS.getAuthorization = util.getAuth;
COS.version = '0.4.23';
COS.version = '0.4.24';

module.exports = COS;

Expand Down Expand Up @@ -10402,18 +10404,18 @@ var util = __webpack_require__(0);

// 文件分块上传全过程,暴露的分块上传接口
function sliceUploadFile(params, callback) {
var self = this;
var ep = new EventProxy();
var TaskId = params.TaskId;
var Bucket = params.Bucket;
var Region = params.Region;
var Key = params.Key;
var Body = params.Body;
var ChunkSize = params.ChunkSize || params.SliceSize || this.options.ChunkSize;
var ChunkSize = params.ChunkSize || params.SliceSize || self.options.ChunkSize;
var AsyncLimit = params.AsyncLimit;
var StorageClass = params.StorageClass || 'Standard';
var ServerSideEncryption = params.ServerSideEncryption;
var FileSize;
var self = this;

var onProgress;
var onHashProgress = params.onHashProgress;
Expand Down Expand Up @@ -10532,7 +10534,7 @@ function sliceUploadFile(params, callback) {
var AutoChunkSize = 1024 * 1024;
for (var i = 0; i < SIZE.length; i++) {
AutoChunkSize = SIZE[i] * 1024 * 1024;
if (FileSize / AutoChunkSize <= 1024) break;
if (FileSize / AutoChunkSize <= self.options.MaxPartNumber) break;
}
params.ChunkSize = params.SliceSize = ChunkSize = Math.max(ChunkSize, AutoChunkSize);
})();
Expand Down Expand Up @@ -11430,7 +11432,7 @@ function sliceCopyFile(params, callback) {
var AutoChunkSize = 1024 * 1024;
for (var i = 0; i < SIZE.length; i++) {
AutoChunkSize = SIZE[i] * 1024 * 1024;
if (FileSize / AutoChunkSize <= 1024) break;
if (FileSize / AutoChunkSize <= self.options.MaxPartNumber) break;
}
params.ChunkSize = ChunkSize = Math.max(ChunkSize, AutoChunkSize);

Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/cos.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var defaultOptions = {
ChunkParallelLimit: 3,
ChunkRetryTimes: 3,
ChunkSize: 1024 * 1024,
ChunkMaxCount: 10000,
SliceSize: 1024 * 1024,
CopyChunkParallelLimit: 20,
CopyChunkSize: 1024 * 1024 * 10,
Expand Down

0 comments on commit d22de28

Please sign in to comment.