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

@serialpilot/hdlc

v0.1.0

Published

Pure-function HDLC byte-stuffing framer/unframer with optional CRC-16/CCITT-FALSE FCS (PPP, MAVLink, AX.25). Browser-clean — no node:* imports.

Readme

@serialpilot/hdlc

Pure-function HDLC byte-stuffing framer/unframer with optional CRC-16/CCITT-FALSE FCS — the framing layer used by PPP, MAVLink, and AX.25. No node:* imports — runs unchanged in browsers and Web Serial.

Install

npm install @serialpilot/hdlc

Use

import { frame, unframe } from '@serialpilot/hdlc'

const payload = new Uint8Array([0x01, 0x7e, 0x42, 0x7d])

// CRC-16/CCITT-FALSE FCS appended (default)
const wire = frame(payload)
const back = unframe(wire)
// → Uint8Array(4) [0x01, 0x7e, 0x42, 0x7d]

// FCS disabled
const wireRaw = frame(payload, { fcs: 'none' })
const backRaw = unframe(wireRaw, { fcs: 'none' })

Wire format

| stuffed(payload + FCS₂) | 0x7E |
  • The trailing 0x7E is the frame delimiter (FLAG).
  • Byte stuffing replaces 0x7E and 0x7D inside the body with 0x7D 0x5E and 0x7D 0x5D respectively.
  • When fcs: 'crc16-ccitt' (default), the 2-byte CRC-16/CCITT-FALSE of the payload is appended little-endian before stuffing, matching the PPP/MAVLink convention.

Options

frame(payload)                            // default: fcs = 'crc16-ccitt'
frame(payload, { fcs: 'none' })           // raw byte-stuffing only
unframe(frame, { fcs: 'crc16-ccitt' })    // verify FCS, throw on mismatch
unframe(frame, { fcs: 'none' })           // unstuff only

Errors

unframe throws HdlcError for malformed input:

| code | meaning | | ----------------- | ------------------------------------------------- | | FCS_MISMATCH | computed CRC ≠ received FCS. | | INVALID_ESCAPE | 0x7E appears unescaped inside the frame body. | | TRUNCATED | frame ends mid-escape, or shorter than the FCS. |

Use @serialpilot/parser-hdlc if you want a Transform stream that emits one unframed payload per 0x7E boundary.

License

MIT.