Closed popzadid closed 7 years ago
Hello @popzadid , Could you please provide me more context about the problem? Eventually a test case with the input you have when it doesn't work.
In functions splitFile.splitFileBySize(path, size)
am input Filesize = 19524568 byte and splitsize is 5242880 byte
after using functions i printed partInfo it's show
[ { number: 1, start: 0, end: 5242880 }, { number: 2, start: 5242880, end: 10485760 }, { number: 3, start: 10485760, end: 14281688 } ]
but It's wrong results because in your iteration 'for (var i = 0; i < parts ; i++)' is your not add last part to split.
This issue has been fixed in 2.1.0
.
This functions not will work correctly please changing a variable like this
var allparts = parts+1; for (var i = 0; i < allparts; i ++) { partInfo[i] = { number: i + 1, start: i * splitSize, end: (i * splitSize) + splitSize }; if (i === (allparts - 1)) { partInfo[i].end = (i * splitSize) + lastSplitSize; } }
thank you