crc-32
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The crc-32 npm package is a standard CRC-32 algorithm implementation in JavaScript. This package, which is usable in both browsers and Node.js, focuses on ensuring correctness, performance, and support for IE6 and above. CRC-32 is widely used in networking protocols and file archives for checking the integrity of data.
The usage of crc-32 in your JavaScript project is relatively straight forward. Firstly, the package needs to be installed using npm, as shown below:
$ npm install crc-32
After successful installation, it can be integrated into your project depending on the environment. In a Node.js or bundler, it can be used as:
var CRC32 = require("crc-32");
For browser usage, the crc32.js
script can be included directly in the HTML file:
<script src="crc32.js"></script>
The package provides several functions to compute the CRC-32 checksum. Examples of usage can be seen below:
// var CRC32 = require('crc-32'); // uncomment this line if in node
CRC32.str("SheetJS") // -1647298270
CRC32.bstr("SheetJS") // -1647298270
CRC32.buf([ 83, 104, 101, 101, 116, 74, 83 ]) // -1647298270
The crc-32 package's documentation can be found within the README file provided in the GitHub repository git://github.com/SheetJS/js-crc32.git
. This includes the installation guide, integration steps, and usage examples which are discussed above. It also provides best practices, testing methodologies, performance insights, and licensing information.