drop buffer-crc32 dependency#173
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why have a dependency for 1 math function when you can copy paste it into your own code. This is, for better or worse, more friendly to security auditing tools.
Closes #172.
The actual changes that come from embedding the
buffer-crc32dependency into this codebase are:new Buffer(integer)expression as a fallback for old versions of node. i think security auditing tools are sophisticated enough to see the conditions around that expression and not complain, but type coercion is unnecessary complexity for yauzl's usecase, and therefor it contributes negative value anyway. deleted.Buffer, so that's the only function left.for...ofto iterate through the bytes of theBufferwhich is potentially more performant, but realistically probably about the same. We're only operating on a few dozen bytes at a time anyway, and only when the rarely used file name compatibility extra field is found in a .zip file, which has been obsolete since 2006.zlib.crc32()for node 20+ and fallback to the pure javascript implementation.now there's only 1 dependency left in yauzl, and it could be obsoleted by an internal overhaul of callbacks to use await, but i'm not sure i'm going to do that right away.