Skip to content
/ crc32-js Public

@allex/crc32 - Provide pure JS CRC32 for nodejs & browser. Supports string, Buffer, ArrayBuffer, Uint8Array

Notifications You must be signed in to change notification settings

allex/crc32-js

Repository files navigation

@allex/crc32

Provide pure JS CRC32 for nodejs & browser. Supports string, Buffer, ArrayBuffer, Uint8Array

Usage

yarn add @allex/crc32 -D
import { crc32 } from '@allex/crc32'

const testBinaryFile = path.resolve(__dirname, 'files', 'me.png')
const arrayBuffer = fs.readFileSync(testBinaryFile);

describe('use pure js crc32.js to test', () => {
  test('crc32() with string, arraybuffer', () => {
    expect(crc32('allex')).toBe(337229299);
    expect(crc32(arrayBuffer, 'hex')).toBe('79c38e61');
  });
});

License

MIT

About

@allex/crc32 - Provide pure JS CRC32 for nodejs & browser. Supports string, Buffer, ArrayBuffer, Uint8Array

Topics

Resources

Stars

Watchers

Forks

Packages