At least one of 2 things are a bug, depending on how getFingerprints works.
If getFingerprints always goes through the end of each chunk it is handed, then there’s an unnecessary copy in Buffer.concat(pending) because pending is cleared on every iteration. This would also mean that the chunking from the stream impacts the fingerprinting and we may want the option of buffering all the data to fingerprint at once.
~If getFingerprints does not always give you fingerprints through the end of the chunk then this code is dropping tail data when it fingerprints and then sliceing the wrong data out of the bl instance it’s using to keep prior tail data.~
I was looking through the rabin usage and I think I found a bug. I commented more thoroughly in the commit introducing it https://github.com/ipfs/js-ipfs-unixfs-importer/commit/542b3e443c30918bf2f7eef26a216c1a64d0ad0e#r34327138
At least one of 2 things are a bug, depending on how
getFingerprints
works.getFingerprints
always goes through the end of each chunk it is handed, then there’s an unnecessary copy inBuffer.concat(pending)
because pending is cleared on every iteration. This would also mean that the chunking from the stream impacts the fingerprinting and we may want the option of buffering all the data to fingerprint at once.getFingerprints
does not always give you fingerprints through the end of the chunk then this code is dropping tail data when it fingerprints and then sliceing the wrong data out of thebl
instance it’s using to keep prior tail data.~