const crc32 = require('buffer-crc32');// works with buffersconst buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);crc32(buf); // -> <Buffer 94 5a ab 4a>// has convenience methods for getting signed or unsigned intscrc32.signed(buf); // -> -1805997238crc32.unsigned(buf); // -> 2488970058// will cast to buffer if given a string, so you can// directly use foreign characters safelycrc32('自動販売機'); // -> <Buffer cb 03 1a c5>// and works in append mode too
tests
This was tested against the output of zlib's crc32 method. You can run
the tests withnpm test (requires tap)