0.0.6 • Published 6 years ago

faster-crc32 v0.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

Cyclic Redundancy Check - 32-bit

A simple CRC32 module that implements the 32-bit cyclic redundancy check, or CRC-32, checksum. This module operates at top performance speed with no dependencies.

Installation:

npm i faster-crc32

Usage

const
    CRC32 = require( 'faster-crc32' ),
    path  = require( 'path' );

console.log( new CRC32( path.resolve( './test.png' ) ) );

Construction:

const filename = './path/to/file.png';
const options  = {
    chunkSize: CRC32.MB,
    encoding: CRC32.HEX
};

const crc      = new CRC32( filename, options );

crc
    .then( console.log )
    .catch( console.error );

Returns: Array

Values: UInt32, HEX, OCTAL, DECIMAL, BINARY

Calculation sizes:

CRC32.WHOLE - calculates hash on entire file

CRC32.B - calculates hash on each byte

CRC32.KB - calculates hash on each kilobyte

CRC32.MB - calculates hash on each megabyte

CRC32.GB - calculates hash on each gigabyte

Calculation outputs:

CRC32.BINARY = sets output to binary

CRC32.OCTAL = sets output to octal

CRC32.DECIMAL = sets output to decimal

CRC32.HEX = sets output to hex

CRC32.INT = sets output to int

CLI:

CRC32 ./path/to/file.png