We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6aca5b2 commit e798577Copy full SHA for e798577
1 file changed
src/flow.js
@@ -79,6 +79,7 @@
79
*/
80
this.defaults = {
81
chunkSize: 1024 * 1024,
82
+ calculateChunkSize: null,
83
forceChunkSize: false,
84
simultaneousUploads: 3,
85
singleFile: false,
@@ -938,8 +939,13 @@
938
939
// Rebuild stack of chunks from file
940
this._prevProgress = 0;
941
var round = this.flowObj.opts.forceChunkSize ? Math.ceil : Math.floor;
942
+ var calculateChunkSize = this.flowObj.opts.calculateChunkSize;
943
+ var chunkSize = this.flowObj.opts.chunkSize;
944
+ if (typeof calculateChunkSize === 'function') {
945
+ chunkSize = calculateChunkSize(this);
946
+ }
947
var chunks = Math.max(
- round(this.size / this.flowObj.opts.chunkSize), 1
948
+ round(this.size / chunkSize), 1
949
);
950
for (var offset = 0; offset < chunks; offset++) {
951
this.chunks.push(
0 commit comments