Skip to content

Conversation

martin-knopf
Copy link

@martin-knopf martin-knopf commented Sep 23, 2024

Hi!

I have recently used this library in the context of content-defined chunking, where I read a file into a buffer and calculate hashes of a sliding window. This produces as many hashes as there are bytes in the buffer. To get the next window, I used Buffer.subarray(), but this is pretty slow because it creates a new buffer. So, with this PR, I would like to propose CRC32.bufrange(buffer, start, end, [, seed]), which allows reusing the same buffer.

Unfortunately, I don’t understand your codebase well enough to know where this new function should go. For starters, I have only added it to crc32.js, but I would be happy to complete this PR with your help.

Best, Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant