Skip to content

Consider using native node:zlib.crc32 when available #34

@thejoshwolfe

Description

@thejoshwolfe

Hi maintainers! I'm a big fan of the simplicity of this package, and I've been using it for years in my software.

It's come to my attention in thejoshwolfe/yazl#82 that node now has a builtin native crc32 API in the zlib package. It looks like the two implementations agree on the math, although the type semantics of the APIs are of course subtly different:

console.log(require("node:zlib").crc32("hello")); // 907060870
console.log(require("buffer-crc32").unsigned("hello")); // 907060870

Would you consider adding a special case for using the native implementation when it's available and falling back to the js implementation otherwise? If that doesn't seem like it makes sense to include in this package, I'll look into doing it in my own code.

If you are interested, would you mind if I opened a PR? (Also, are you interested in a PR that upgrades the tap dependency? It looks like there's a lot of security vulnerabilities in the 6 year old version used in this package.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions