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

@gmod/trix

v3.2.3

Published

Read UCSC Trix indexes in pure JavaScript

Downloads

32,184

Readme

Build Status

trix-js

Read UCSC Trix indexes in pure JavaScript

Install

npm install @gmod/trix

Usage

import Trix from '@gmod/trix'
import { RemoteFile } from 'generic-filehandle2'

// generic-filehandle2 also has LocalFile for files on disk
const trix = new Trix(
  new RemoteFile('https://jbrowse.org/genomes/GRCh38/trix/hg38.ixx'),
  new RemoteFile('https://jbrowse.org/genomes/GRCh38/trix/hg38.ix'),
)

const results = await trix.search('oca')
// => [[term, record], ...]

API

new Trix(ixxFile, ixFile, maxResults?)

  • ixxFile - filehandle for the .ixx file
  • ixFile - filehandle for the .ix file
  • maxResults - most results a search returns, default 20. Also settable afterwards as trix.maxResults

Any object with read(length, position, opts?) resolving to a Uint8Array and readFile({ encoding: 'utf8' }) resolving to a string works, which includes every generic-filehandle2 handle. The exported Filehandle type describes it.

trix.search(searchString, opts?)

Prefix-searches the index and resolves to [term, record][], where term is the indexed word that matched and record is the key it points to. Records are deduplicated, so two terms hitting the same record yield one result.

  • searchString - the query. Each whitespace-separated word is prefix-searched and a record is returned when every word finds it, in any order. A word of a multi-word query is read for at most 200 records (or maxResults, if larger), and one with more cannot rule a record out: b brca2 answers with the brca2 records
  • opts.signal - an AbortSignal to cancel the underlying reads

Reading over HTTP

A search fetches the .ixx once, then reads the .ix from the matching checkpoint, 256 KiB first and doubling after that. A typeahead's consecutive keystrokes read nearby offsets, so typing spd_00 into the 1.7 MB test index makes six reads at three distinct offsets. With @gmod/range-cache-filehandle under both filehandles, four 256 KiB chunks serve all six, and backspacing needs no new fetch:

import { RemoteFileWithRangeCache } from '@gmod/range-cache-filehandle'

const trix = new Trix(
  new RemoteFileWithRangeCache(`${url}.ixx`),
  new RemoteFileWithRangeCache(`${url}.ix`),
)

Reference

See the UCSC trix documentation for the concepts, and ixixx-js for a JavaScript implementation of the ixIxx command that builds these indexes.

See CONTRIBUTING.md for development and release steps.