Skip to content

Commit

Permalink
[BUGFIX] Fixing issue with splitting by size (missing one part). Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvlk committed May 2, 2017
1 parent 36c8743 commit f25cb49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions split-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ SplitFile.prototype.splitFileBySize = function(file, maxSize) {
var totalSize = stat.size;

// Number of parts (exclusive last part!)
var parts = Math.floor(totalSize / maxSize); //
var parts = Math.ceil(totalSize / maxSize);
var splitSize = maxSize;

// If size of the parts is 0 then you have more parts than bytes.
Expand All @@ -119,7 +119,7 @@ SplitFile.prototype.splitFileBySize = function(file, maxSize) {
end: (i * splitSize) + splitSize
};

if (i === parts-1) {
if (i === parts) {
partInfo[i].end = (i * splitSize) + lastSplitSize;
}
}
Expand Down

0 comments on commit f25cb49

Please sign in to comment.