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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cli-plot

v1.0.0

Published

Plot values from stdin directly in your terminal

Downloads

3

Readme

cli-plot

Plot values from stdin directly into your terminal.

NPM License Dependencies

npm install -g cli-plot

Usage

Say you have the following shell script that outputs numbers on stdout:

for i in {1..50}; do
  echo $RANDOM;
  sleep 1;
done

Or the following Node program that outputs a sine wave:

var i = 0;
setInterval(function() {
  var value = Math.sin(i += 0.2);
  process.stdout.write(value + '\n');
}, 100);

You can pipe it into plot to generate a chart right there in your terminal. It will push new values from the right every time they arrive on stdin. Note: input values must be separated by a new line.

node sine.js | plot

Screenshot

Arguments

  • plot -w 100: graph width (in terminal rows)
  • plot -h 10: graph height (in terminal rows)

Advanced usage

  • Printing averages

If the input program outputs numbers very often, the chart will probably move too fast. You can pipe the output into a tool like cli-average.

./random.sh | avg -t 1s | plot
  • Watching the output of another program

One common usage is to run a command at a given rate, and plot its results.

Unfortunately, the watch command also outputs debug info and ANSI escape codes, which doesn't play well with plot. You'll need to use different way to watch that command, for example cli-interval.

interval -t 1s "echo $RANDOM" | plot
  • Getting values from JSON documents

The easiest way is to use tools like json or jQ.

some_program | json "path.to.value" | plot