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

@cacheplane/json-stream

v0.0.4

Published

Streaming incremental JSON parser with push/pull APIs, node guards, and JSON Pointer resolution.

Readme

@cacheplane/json-stream

Incremental JSON parser for input that arrives a chunk at a time.

Use it when an AI model, network stream, worker, or tool call emits JSON progressively. JSON.parse() needs a complete document; this parser gives you a typed tree while the document is still arriving, marking each node partial or complete so you can render what has landed and leave the rest.

Install

npm install @cacheplane/json-stream

Runtime and packaging:

  • Node >=20
  • TypeScript declarations included
  • ESM and CJS bundled
  • Zero runtime dependencies
  • Marked side-effect free

30-Second Example

import { create, push, finish, isObjectNode } from "@cacheplane/json-stream";

let state = create();

for (const chunk of ['{"name": "Ada', '", "age": 3', "6}"]) {
  state = push(state, chunk);
}

state = finish(state);

if (isObjectNode(state.root)) {
  // Every node carries a status, so a half-arrived string is still readable.
  console.log(state.root.status); // "complete"
}

Mental Model

Three functions drive the whole parser, and each returns a new StreamState rather than mutating the one you passed:

  • create() — a fresh, empty state.
  • push(state, chunk) — feed the next chunk; safe to call at any byte boundary, including mid-token and mid-escape-sequence.
  • finish(state) — signal end of input. Anything still open is resolved or reported as a StreamError.

Every node in the tree carries a status of partial or complete. That is the distinction the whole library exists for: a consumer can render a string that is still arriving, and know not to treat it as final.

Type Guards

Narrowing helpers for each node kind, plus a status check:

import {
  isArrayNode,
  isBoolNode,
  isComplete,
  isNullNode,
  isNumberNode,
  isObjectNode,
  isStringNode,
} from "@cacheplane/json-stream";

isComplete(node) is the one to reach for when deciding whether a value is safe to commit downstream.

JSON Pointer Lookup

resolve reads a node out of the tree by RFC 6901 pointer, which is convenient when you care about one field of a large streaming document:

import { resolve } from "@cacheplane/json-stream";

const node = resolve(state.root, "/choices/0/message/content");

It returns undefined when the path does not exist yet — a normal condition mid-stream, not an error.

Related

License

MIT