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

@hamster-note/txt-parser

v0.1.0

Published

TXT parser package workspace for HamsterNote.

Readme

@hamster-note/txt-parser

@hamster-note/txt-parser provides a UTF-8 text parser for the HamsterNote ecosystem, converting raw TXT data into structured intermediate documents and back.

Features

  • TxtParser — A DocumentParser subclass for UTF-8 TXT files
  • inspectTxt — Inspect TXT input without modifying it
  • Deterministic encoding — Convert UTF-8 bytes into IntermediateDocument with stable IDs
  • Deterministic decoding — Reconstruct UTF-8 bytes from IntermediateDocument
  • UTF-8 only — Non-UTF-8 input will fail with explicit error messages
  • BOM handling — UTF-8 BOM (byte order mark) is silently stripped during encode

Scope

This package only supports UTF-8 encoding. Other encodings are not supported in this phase.

Installation

yarn install

Development Commands

yarn typecheck          # Type-check the codebase
yarn test -- --runInBand # Run Jest tests
yarn build              # Build the package
yarn dev                # Start demo server on port 8000
npm run dev             # Alternative: start demo server

Usage

import { TxtParser } from '@hamster-note/txt-parser'

// Encode UTF-8 text into an IntermediateDocument
const doc = await TxtParser.encode(new TextEncoder().encode('Hello'))

// Decode back to UTF-8 bytes
const bytes = await TxtParser.decode(doc)
const text = new TextDecoder('utf-8').decode(bytes)

// Inspect input without modifying it
import { inspectTxt } from '@hamster-note/txt-parser'
const info = await inspectTxt(new Blob(['Hello'], { type: 'text/plain' }))

Demo

A static browser demo is available at demo/index.html. Start the demo server:

yarn build && yarn dev

Then open http://localhost:8000/demo/index.html in your browser.

API

TxtParser

Extends DocumentParser from @hamster-note/document-parser.

  • TxtParser.ext'txt'
  • TxtParser.exts['txt']
  • TxtParser.encode(input) → Encode UTF-8 bytes into IntermediateDocument
  • TxtParser.decode(document) → Decode IntermediateDocument back to UTF-8 bytes
  • TxtParser.inspect(input) → Inspect input and return metadata

inspectTxt(input)

Standalone export that delegates to TxtParser.inspect(input).

Error Handling

  • Invalid UTF-8 input during encode: throws TxtParser 编码失败:输入不是有效的 UTF-8 TXT 数据
  • Decode with no pages: throws TxtParser 解码失败:中间文档不包含可解码页面

License

MIT