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

cspell-trie

v9.6.4

Published

Trie Data Structure reader for cspell

Readme

cspell-trie

Trie library for use with cspell

This library allows easily building of a Trie from a word list.

The resulting trie can then be compressed into a DAFSA|DAWG.

Tool

cspell-trie is both a tool and a library.

Give a list of words, cspell-trie will turn it into a trie file.

Installation

npm install -g cspell-trie

Usage

cspell-trie --help

Creating a trie file

cspell-trie create filename.txt -o filename.trie

Reading a trie file

cspell-trie reader filename.trie

File Format

Header

TrieXv1
base=10

The header has two parts.

  • TrieXv1 -- the identifiers
  • base -- offsets are stored using the base (10, 16, 32) are common. higher the base, the smaller the file. Max is 36

Data

The first line of data is always a *

Each line is a node in the Trie.

The format of each line is:

star [char index [, char index]*]

  • star - the presence of a star indicates that the node is the ending of a word.
  • char - a character that can be appended to the word followed by the node at index.
  • index - the offset in the list of nodes to continue appending

In other words, each line has an optional * followed by 0 or more (char, index) pairs. A missing index implies an index of 0, which is the end of word flag.

Example Line: *s1,e -- The word can stop here, or add an s and continue at node 1, or add an e

Example:

Word List:

  • walk
  • walked
  • walker
  • walking
  • walks
  • talk
  • talks
  • talked
  • talker
  • talking

becomes

Output: (Offsets are added for clarity, but do not exist in output)

Offset  Output
------- --------
        TrieXv1
        base=10
0       *
1       d,r
2       g
3       n2
4       *e1,i3,s
5       k4
6       l5
7       a6
8       t7,w7

The root of the trie is the last offset, 8. It is designed for the entire trie to be in memory, which is why the root is at the end. This allows for efficiently building the trie as the file loads line by line, because each line can only refer to previous lines.

How to walk the data to see if "talks" is in it.

  1. Start with the root at offset 8.
  2. t found goto 7
  3. a found goto 6
  4. l found goto 5
  5. k found goto 4
  6. s found stop (goto 0 is stop).

CSpell for Enterprise