buffer-crc32
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Buffer-crc32 is a pure JavaScript CRC32 algorithm that is designed to work effectively with binary data. Not only can it handle binary data, but it also processes special character sets with ease, providing output as buffer, signed or unsigned data. Buffer-crc32 is particularly valuable because of its versatility and comprehensive test structure.
Using Buffer-crc32 with JavaScript is straightforward once it has been installed using npm install buffer-crc32
. For instance, you can use it with buffers as in the code below:
var crc32 = require('buffer-crc32');
var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
crc32(buf); // -> <Buffer 94 5a ab 4a>
Furthermore, Buffer-crc32 offers convenience methods for returning signed or unsigned ints:
crc32.signed(buf); // -> -1805997238
crc32.unsigned(buf); // -> 2488970058
You can use Buffer-CRC32 directly with strings, and safely employ foreign characters:
crc32('自動販売機'); // -> <Buffer cb 03 1a c5>
Buffer-crc32 also offers an append mode option:
var partialCrc = crc32('hey');
partialCrc = crc32(' ', partialCrc);
partialCrc = crc32('sup', partialCrc);
partialCrc = crc32(' ', partialCrc);
var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
This versatility in application makes Buffer-crc32 a handy tool for processing a diverse range of data subsets with JavaScript.
The documentation for Buffer-crc32 can be accessed on the dedicated GitHub page at git://github.com/brianloveswords/buffer-crc32.git. This open-source resource provides a wealth of information about the package's capabilities, offers detailed examples of how and when to use it, and details its license terms. The readme file on the page serves as the main documentation component, offering quick access to installation guide, usage samples, and testing details. For developers engaged in creating or managing applications that handle binary data, this resource can be invaluable.