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

@chad3814/yenc

v2.0.0

Published

Pure-TypeScript yEnc decoder with header parsing and CRC32 verification

Readme

@chad3814/yenc

Pure-TypeScript yEnc decoder with header parsing and CRC32 verification.

Status: 2.0.0. Zero runtime dependencies, no native build step.

import { decodeArticle } from '@chad3814/yenc';

const article = decodeArticle(body, { verify: true });

article.header.name; // authoritative filename — the NZB has no filename field
article.header.size; // authoritative decoded size of the complete file
article.part; // { begin, end } within the file, or null for a single-part post
article.data; // decoded bytes

Why pure TypeScript

@thaunknown/yencode is SIMD-accelerated and has a verifiable upstream, but it is a native module built through node-gyp-build. Decoding runs at hundreds of MB/s in plain JavaScript against a Usenet connection that tops out far below that, so the work is network-bound and the SIMD buys nothing here — while the native build costs every CLI user an install that can fail.

What this does that the reference stack does not

  • Single-part posts work. Single-part yEnc has no =ypart line at all. [email protected] reads props!.part.end unconditionally and throws a TypeError on every single-segment file — in practice, on exactly the .nfo and thumbnail you want for a cheap preview. YencArticle.part is nullable so the case cannot be ignored.
  • CRC32 is actually checked. @thaunknown/yencode exposes no comparison and nzb-file's fromPost never reads the trailer, so a "verified" download verified nothing. Every article carries a pcrc32 covering itself, which makes articles integrity-checkable without PAR2.
  • The right checksum is used. On a multipart article pcrc32 covers that part while crc32, present on the final part, covers the whole reassembled file. Comparing the whole-file value against one part's bytes fails a perfectly good article.
  • Offsets are converted. =ypart begin=1 end=16 is 1-based and inclusive on the wire. YencPartRange is 0-based half-open, matching Blob.slice and the rest of this repo. Getting this wrong writes every part one byte off.
  • matches is nullable. A trailer with no checksum yields null, not false — "nothing to check" and "check failed" are different answers.

What this deliberately does not do

  • Dot-unstuffing. NNTP transmits a body line beginning with . as .., and removing that is the transport's job — @chad3814/nntp hands out bytes that are already unstuffed. A decoder fed stuffed bytes corrupts them silently. How often that matters depends on the encoder: yEnc recommends escaping . at the start of a line, and a real post measured 0 stuffed lines in 66,563, so this is a correctness requirement rather than a frequent event.
  • Encoding. Decoding is what a downloader needs. An encoder will land when there is a reason to post.

Testing

38 unit tests, including a round trip over all 256 byte values against a reference encoder kept in the test file. The decoder is also mutation-tested: reverting the 1-based offset conversion, swapping pcrc32 for crc32, assuming =ypart is always present, or perturbing either decode offset each fail multiple tests.