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

catena-corpus

v0.3.1

Published

Turn a pile of files into a searchable corpus: chunking, scrubbing, subtitles and rank fusion, as WebAssembly

Downloads

468

Readme

catena

Turn a pile of files into a searchable corpus: chunking, scrubbing, subtitles and rank fusion, as WebAssembly.

npm install catena-corpus
import { chunkMarkdown, scrub, countTokens, fuseHits } from "catena-corpus";

const chunks = chunkMarkdown(markdown, 512, 64);
chunks[0].page;      // 41
chunks[0].chapter;   // 'III. The Second Estate'

const clean = scrub(rawMarkdown, true);
countTokens(clean);

fuseHits([...vectorHits, ...textHits], undefined, { vec: 2 }, 20);

Records come back as plain objects — the same documents the command-line tools write, with the same field names and the same stability promise. Nothing has to be freed.

splitCollection throws when the document is one work rather than a collection, which is the usual answer:

let works;
try {
  works = splitCollection(markdown);
} catch (why) {
  works = [{ idx: 0, title, text: markdown }];
}

What is here

| | | |---|---| | chunkMarkdown | Markdown into passages that carry their page, chapter and role | | scrub | Converted markdown in, clean markdown out | | countTokens | Tokens, by the encoding the budgets count in | | parseSubtitles | SubRip, WebVTT or ASS into cues | | packCues | Cues into passages, keeping the times they were said at | | segmentCues | A timed transcript into topic chapters | | cueWindows | The windows segmentCues measures, to embed | | splitCollection | One markdown file into the works inside it | | fuseHits | Several ranked lists into one | | identify | What a file is, from its first bytes | | seriesOf | The series a book belongs to, and which volume this is | | parseIdentifier | A DOI, ISSN, ISBN or arXiv id, read and checked |

The tools that read files or call another program are not here: a browser has neither, and a binding that pretends otherwise fails at run time rather than at compile time. Those stay command-line tools.

Node and the web

import { chunkMarkdown } from "catena-corpus";        // resolves per environment
import { chunkMarkdown } from "catena/node";   // or pick one
import { chunkMarkdown } from "catena/web";

Two builds because the loaders differ: node reads the .wasm off disk at import, the web build takes a URL a bundler rewrites.

Licence

MPL-2.0. Source: https://git.pumpin.online/funkpower/catena