npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

reedsolomon.ts

v1.0.0

Published

Reed-Solomon error correction codec over GF(2^8) in TypeScript. Ported from cho45/reedsolomon.js (ZXing).

Downloads

104

Readme

reedsolomon.ts

TypeScript port of cho45/reedsolomon.js, which is itself a port of ZXing's Reed-Solomon codec.

Reed-Solomon error correction encoding and decoding over GF(2^8). Zero dependencies.

Install

npm install reedsolomon.ts

Usage

import {
    RS_Encoder,
    RS_Decoder,
    GF_DATA_MATRIX_256,
} from 'reedsolomon.ts';

const field = GF_DATA_MATRIX_256();
const encoder = new RS_Encoder(field);
const decoder = new RS_Decoder(field);

// message = 24 data bytes + 8 parity bytes = 32 total
const message = new Int32Array(32);
for (let i = 0; i < 24; i++) message[i] = i;

// Encode: parity bytes are written to positions [24, 32)
encoder.encode(message, 8);

// Corrupt up to 4 bytes (8 parity bytes / 2 = 4 correctable errors)
message[5] = 0xff;
message[10] = 0xff;
message[20] = 0xff;
message[30] = 0xff;

// Decode: corrects errors in-place
decoder.decode(message, 8);
// message[0..24] is restored to original data

API

GF_DATA_MATRIX_256()

Returns a Generic_GF field for GF(2^8) with primitive polynomial x^8 + x^5 + x^3 + x^2 + 1 (0x012D), generator base 1. Used by Data Matrix and Aztec codes.

GF_QR_CODE_256()

Returns a Generic_GF field for GF(2^8) with primitive polynomial x^8 + x^4 + x^3 + x^2 + 1 (0x011D), generator base 0. Used by QR codes.

new RS_Encoder(field)

Creates an encoder for the given Galois field.

encoder.encode(data: Int32Array, ec_bytes: number): void

Encodes in-place. data must have length = data bytes + ec_bytes. Data occupies positions [0, data_bytes) and parity is written to [data_bytes, length).

new RS_Decoder(field)

Creates a decoder for the given Galois field.

decoder.decode(received: Int32Array, ec_bytes: number): void

Decodes (corrects errors) in-place. Can correct up to ec_bytes / 2 byte errors. Throws if errors exceed correction capacity.

Generic_GF

Galois field implementation. Use the factory functions above unless you need a custom field.

new Generic_GF(primitive: number, size: number, generator_base: number)

Creates a custom Galois field with the given primitive polynomial, size, and generator base.

License

Apache-2.0. See LICENSE.

Original Java implementation: Copyright 2007 ZXing authors. JavaScript port: cho45. TypeScript port: ecartz.