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

@sabakernel/arrow-header

v0.1.4

Published

Robust > delimited stream header parser & builder for Deno and npm.

Readme

arrow-header

JSR

JSR: https://jsr.io/@sabakernel/arrow-header


Japanese version: README.ja.md

Note: This English README was produced using machine translation. Please refer to the Japanese original above for the authoritative text.

arrow-header is a small library to parse and build a custom fixed-length header format separated by the > character, for example:

029>PROTOCOLNAME.v1>TYPE>200>

Features

  • Pure Deno, zero external dependencies — runs on the standard runtime only.
  • Strict validation: checks for length mismatches, prohibited zero-padding, Int64 overflow, invalid delimiters, and other format violations.
  • Multibyte (Japanese) safe: header sizes are calculated using UTF-8 byte length, not character count.
  • Stream-friendly: can extract the header portion even when the input string contains the body (content) appended after the header.
  • BigInt support: ContentSize is treated as a bigint (positive Int64 range), so large payloads are supported.

Usage

1. Build a header (buildHead)

Assemble a header string from a Head object. The function automatically prefixes the total byte length (zero-padded).

const head: Head = {
  ContentVersion: 'PROTOCOLNAME.v1',
  ContentType: 'JSON',
  ContentSize: 200n,
};

const headerString = buildHead(head);
console.log(headerString);
// Output: 029>PROTOCOLNAME.v1>JSON>200>

2. Read a header (readHead)

Parse the header portion from a string and return it as an object. The function tolerates additional data (the content body) appended after the header.

const input = '029>PROTOCOLNAME.v1>JSON>200>{"message":"hello"}';

const head = readHead(input);
console.log(head);
/*
Output:
{
  ContentVersion: "PROTOCOLNAME.v1",
  ContentType: "JSON",
  ContentSize: 200n
}
*/

Limitations

  • MaxHeadSize (126 bytes): The total header length including the initial length prefix (LengthPrefix) must not exceed 126 bytes.
  • Forbidden character: ContentVersion and ContentType must not contain the delimiter character >.
  • Zero-padding rules:
    • The leading header length (LengthPrefix) must always be three digits, zero-padded (for example 029).
    • ContentSize must not have unnecessary leading zeros (for example 020 is invalid), except the single value 0 is allowed.
029 > PROTOCOLNAME.v1 > TYPE > 200 > (followed by data...)
 [--]   [------------]   [--]   [-]
  |           |           |      |
  |           |           |      +-- ContentSize   (bytes / no zero-padding)
  |           |           +--------- ContentType   ('>' not allowed)
  |           +--------------------- ContentVersion ('>' not allowed)
  +--------------------------------- LengthPrefix  (total length / 3 digits)

  └─────────────── Maximum 126 bytes (MaxHeadSize) ───────────────┘

Why >?

  • Avoid conflicts with JSON and other payloads: using , could cause parsing ambiguities with content that follows immediately after the header (for example JSON), so > reduces boundary-guessing risks.
  • Readability: the pipe character | can be visually confused with 1, l, or I in some fonts; > offers better clarity while debugging.
  • Stream semantics: in streaming scenarios like Header -> Content -> Header..., > reads naturally as an arrow/separator between segments.