Closed delprofundo closed 5 years ago
Same problem.
Can you provide me with your parameters of the chunk size, the node version and the package version? @delprofundo @snowww1014
Hello @tomvlk !
I'm digging through the code and see this:
The lastSplitSize value is a negative number. Is it ok?
There is one more bug I think I found (line 123):
This condition will be never executed because i
will always be less the parts
value (have a look and the loop condition on line 111: for (var i = 0; i < parts; i ++)
)
@tomvlk I created a PR (https://github.com/tomvlk/node-split-file/pull/31) But I'm not sure if this code is necessary at all.
Both tests show the same size with and without the fix. What do you think?
Well, to be honest, the tests are very limited and doesn't include enough test cases to be strict and should be improved, this is I think why the tests didn't catch this bug.
I looked at the code and indeed, this is the exact bug, I will merge your pull request and submit a new version to NPM right away.
Thank you @AleksMeshkov
Ah, @AleksMeshkov I just found out that there is another issue when you have a decimal maxSize. To handle this I round the input maxSize. Also, I simplified the code a bit.
@tomvlk I created a PR (#31) But I'm not sure if this code is necessary at all.
Both tests show the same size with and without the fix. What do you think?
@tomvlk and what about this? Do you think we need this logic at all? I mean calculation of the last chunk size. Without this, code works the same.
@AleksMeshkov I updated the code because calculating is not necessary. The last chund end should be the total size of the file and that is how it's been implemented right now.
awesome. im building a test suite this weekend that could use it.
Split by size (say at 1000000 bytes)
using this:
does this