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

lnp

v1.0.3-dev

Published

A compact and deterministic length-prefixed serialization format with a minimal, unambiguous grammar.

Readme

WIP

LNP — Length-Notation Protocol

LNP is a compact, deterministic, length-prefixed data serialization format. It encodes structured data (objects, arrays, primitives, and binary) using a minimal grammar and unambiguous parsing rules. The design goal is to provide a simple, stream-friendly, and implementation-agnostic protocol suitable for storage, messaging, and structured binary or textual data exchange.


Core Idea

Every value is encoded as:

<type-char><byte-length>:<payload-bytes>

Where:

  • <type-char> — a single ASCII character indicating the value type
  • <byte-length> — decimal ASCII length of the payload in bytes
  • : — required separator
  • <payload-bytes> — exactly <byte-length> bytes of content

This eliminates the need for delimiters, escaping, or structural markers. All nested values remain valid LNP values.


Type Table

| Type | Char | Payload Description | | ------- | ---- | ----------------------------------------------------------- | | Object | o | Sequence of entries <klen>:<kbytes><value> | | Array | a | Sequence of complete LNP values | | String | s | Raw UTF-8 string bytes | | Number | n | ASCII numeric representation (-12, 3.14, etc.) | | Boolean | b | Single byte: t or f | | Null | N | Must have zero-length payload | | Bytes | B | Base64-encoded bytes (or raw bytes, implementation defined) |


Objects

Object payloads consist of repeated entries:

<key-length>:<key-bytes><value>

Where <value> is a complete LNP value including its type and length prefix.

Example:

o27:name4:Johnage2:n24

Represents:

{
  "name": "John",
  "age": 24
}

Arrays

Arrays concatenate multiple full LNP values inside the payload:

a14s3:foos3:bar

Equivalent to:

["foo", "bar"]

Primitives

String

s5:hello

Number

n4:-2.5

Boolean

b1:t     // true
b1:f     // false

Null

N0:

Bytes

B12:SGVsbG8gV29ybGQ=

EBNF Specification

value       = typeChar length ":" payload ;
typeChar    = "o" | "a" | "s" | "n" | "b" | "N" | "B" ;
length      = digits ;
digits      = digit { digit } ;
payload     = bytes(length) ;

object      = "o" length ":" { entry } ;
entry       = digits ":" bytes(keylen) value ;

array       = "a" length ":" { value } ;

bytes(n) means exactly n raw bytes, without interpretation.


Design Properties

  • Deterministic: identical input always produces identical output.
  • Non-ambiguous: no quoting, escaping, or delimiter rules.
  • Streaming-friendly: parser can process values incrementally.
  • Compact: minimal overhead, fixed structural cost.
  • Easy to implement: simple state machine and length-bounded reads.
  • Suitable for hashing: stable representation ideal for merkle-tree or content-addressed storage.

Roadmap

  • [x] Official Node.js encoder/decoder
  • [ ] Reference test suite
  • [ ] Implementations in Rust, Go, Python
  • [ ] Optional binary variant (BLNP)