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

jtxt

v0.1.7

Published

A CLI tool like awk but using js grammar instead

Readme

Rust CI

$ jtxt 'var it = l.split("]")[2]; console.log(it)' gc.log

Quick Start

Download from the release, run the binary executable file or node jtxt.js

从release中下载二进制文件直接运行即可,或者使用node jtxt.js

Usage

$ jtxt -h
Processes lines of input with JavaScript

Usage: jtxt [OPTIONS] <function> [file]

Arguments:
  <function>  JavaScript code to process each line, l is the origin string
  [file]      Path to the input file. If not provided, reads from stdin.

Options:
  -b, --begin <begin>  JavaScript code to execute before processing any lines
  -e, --end <end>      JavaScript code to execute after processing all lines
  -h, --help           Print help
  -V, --version        Print version

Example with 1.txt

# 1 filter the lines that only contains numbers from 1.txt
# 1 从1.txt中过滤全是数字的行
$ jtxt 'if (l.match(/^\d+$/)) console.log(l)' 1.txt
200
404
200

# 2 compute the character number of 1.txt (exclude the [\r]\n)
# 2 计算1.txt中的字符个数(除了换行符[\r]\n)
$ jtxt -b 'ctx.s=0' 'ctx.s += l.length' -e 'console.log(ctx.s)' 1.txt
168

# 3 filter the lines that contains `Request`, and process the time text, then analyze the distribution of quantity per hour
# 3 过滤含有Request的行,并将时间部分进行处理,分析每个小时的请求数量分布
$ jtxt 'if(l.indexOf("Request")>=0) console.log(l)' 1.txt \
    | jtxt -b 'ctx.m={}' 'var k = "h" + new Date(l.substring(0,19)).getHours(); if(!ctx.m[k]) ctx.m[k]=0; ctx.m[k]++' -e 'console.log(ctx.m)' 1.txt
{ h13: 2, h0: 3, h14: 1, hNaN: 1 }

Well, to simplify the command, you can also use the preset variable: var ctx = { n1:0, n2:0, n3:0, s:'', arr:[]}

你也可以用内置的变量ctx来简化指令,var ctx = { n1:0, n2:0, n3:0, s:'', arr:[]}

Performance

Count the word count of a 10G random log file (generated by file_gen.js). Compared with awk, there is almost no difference.

对10G的随机日志文件进行字数统计(由file_gen.js产生),对比awk几乎没有差距,多次运行各有胜负:

image