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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jkbonfield/htscodecs

v0.5.1

Published

Reference implementation of CRAM 3.1 codecs

Downloads

1,464

Readme

Reference implementation files

This directory contains javascript implementations of the custom codecs using in CRAM 3.1, capable of being run under node.js.

These is not written for speed, but for clarity and as an exercise in checking the pseudocode in the CRAM specification. It is written as close to this pseudocode as is possible.

Prerequisites: minimist package for command line parsing and bzip2 for part of the arith_gen.js code.

npm install minimist
npm install bzip2

iostream.js

Makes a buffer appear to be a stream with ReadByte, ReadITF8, etc functions.

rans.js

Implements the order-0 and order-1 rans (4x8) decoder as used in CRAM3.0.

main_rans.js

A command line tool to exercise the rans.js code, included for debug purposes.

rans4x16.js, main_rans4x16.js

A 16-bit renormalising variant of rANS above. This also includes transforms for RLE, bit-packing and 4-way interleaving.

arith_sh.js

Arithmetic (range) coding with Schindler carry handling.

byte_model.js

An adaptive model for keeping track of symbol frequencies.

arith_gen.js, main_arith_gen.js

Wrapper around arith_sh.js to perform order-0/1 encoding with RLE and bit-packing. Plus debug command line tool

fqzcomp.js, main_fqzcomp.js

Implements the fqzcomp quality compression codec. Plus debug command line tool.

tok3.js, main_tok3.js

Implements the tokenise_name3 read identifier compression codec. Plus debug command line tool.

Testing

The various main js files can be used for adhoc testing. There is also a Makefile which performs checks against known defined data streams and does round-trip testing in both Javascript and if compiled the C variant. You can set CORPUS make variable to a larger data set such htscodecs-corpus.

eg.

make check CORPUS=../tests/htscodecs-corpus/