Skip to content

Commit

Permalink
Release v2.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AidasK committed Jan 21, 2020
1 parent d951c40 commit 45dcba1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
22 changes: 17 additions & 5 deletions dist/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Flow.js is a library providing multiple simultaneous, stable and
* resumable uploads via the HTML5 File API.
* @param [opts]
* @param {number} [opts.chunkSize]
* @param {number|Function} [opts.chunkSize]
* @param {bool} [opts.forceChunkSize]
* @param {number} [opts.simultaneousUploads]
* @param {bool} [opts.singleFile]
Expand Down Expand Up @@ -89,6 +89,7 @@
headers: {},
withCredentials: false,
preprocess: null,
changeRawDataBeforeSend: null,
method: 'multipart',
testMethod: 'GET',
uploadMethod: 'POST',
Expand Down Expand Up @@ -749,6 +750,12 @@
* @type {string}
*/
this.uniqueIdentifier = (uniqueIdentifier === undefined ? flowObj.generateUniqueIdentifier(file) : uniqueIdentifier);

/**
* Size of Each Chunk
* @type {number}
*/
this.chunkSize = 0;

/**
* List of chunks
Expand Down Expand Up @@ -937,8 +944,9 @@
// Rebuild stack of chunks from file
this._prevProgress = 0;
var round = this.flowObj.opts.forceChunkSize ? Math.ceil : Math.floor;
this.chunkSize = evalOpts(this.flowObj.opts.chunkSize, this);
var chunks = Math.max(
round(this.size / this.flowObj.opts.chunkSize), 1
round(this.size / this.chunkSize), 1
);
for (var offset = 0; offset < chunks; offset++) {
this.chunks.push(
Expand Down Expand Up @@ -1152,7 +1160,7 @@
* Size of a chunk
* @type {number}
*/
this.chunkSize = this.flowObj.opts.chunkSize;
this.chunkSize = this.fileObj.chunkSize;

/**
* Chunk start byte in a file
Expand Down Expand Up @@ -1266,7 +1274,7 @@
getParams: function () {
return {
flowChunkNumber: this.offset + 1,
flowChunkSize: this.flowObj.opts.chunkSize,
flowChunkSize: this.chunkSize,
flowCurrentChunkSize: this.endByte - this.startByte,
flowTotalSize: this.fileObj.size,
flowIdentifier: this.fileObj.uniqueIdentifier,
Expand Down Expand Up @@ -1376,6 +1384,10 @@

var uploadMethod = evalOpts(this.flowObj.opts.uploadMethod, this.fileObj, this);
var data = this.prepareXhrRequest(uploadMethod, false, this.flowObj.opts.method, this.bytes);
var changeRawDataBeforeSend = this.flowObj.opts.changeRawDataBeforeSend;
if (typeof changeRawDataBeforeSend === 'function') {
data = changeRawDataBeforeSend(this, data);
}
this.xhr.send(data);
},

Expand Down Expand Up @@ -1617,7 +1629,7 @@
* Library version
* @type {string}
*/
Flow.version = '2.13.2';
Flow.version = '2.14.0';

if ( typeof module === "object" && module && typeof module.exports === "object" ) {
// Expose Flow as module.exports in loaders that implement the Node
Expand Down
Loading

0 comments on commit 45dcba1

Please sign in to comment.