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 🙏

© 2025 – Pkg Stats / Ryan Hefner

terminatorator

v1.0.2

Published

A terminal emulator for your browser

Downloads

11

Readme

Terminatorator

A convincingly realistic fake terminal for your webapp (demo).

Image of a Terminatorator running. Looks boss.

How to use

Add a div to your web page hold the terminal:

<div id="terminal"></div>

Create the terminal:

import {
  createTerminal
} from 'terminatorator'

createTerminal(document.getElementById('terminal'), {
  welcome: 'hello world', // will be printed on start
  theme: 'interlaced', // || 'modern' || 'white' - can be changed at runtime
    // using the `theme` command
  commands: {}, // see `Adding custom commands` below
  files: {}, // see `Files` below
  history: 'cli-history', // the localStorage key used to store terminal history
  user: 'alex' // which user to be logged in as
})

Adding custom commands

const myCommand = {
  handler: (args, session) => {
    // Do something with args and return either:
    //  - nothing
    //  - a string
    //  - a promise of a string
    //  - an Iterable of strings (e.g. an Array or other Symbol.iterator)
    //  - an async iterable of strings
  },
  args: {
    // The optional args object will be passed as the `opts` argument to yargs-parser.
    // See https://www.npmjs.com/package/yargs-parser#requireyargs-parserargs-opts
  }
}

createTerminal(document.getElementById('terminal'), {
  commands: {
    // the key is where in the fs the command should be mounted, the value is
    // the command as defined above
    '/usr/local/bin/my-command': myCommand
  }
})

Command handlers take two arguments - args and session.

Files

You can pre-create any files in the filesystem:

createTerminal(document.getElementById('terminal'), {
  files: {
    // the key is where in the fs the file should be, the value is
    // the attributes of the file. All keys are optional.
    '~/Documents/foo.txt': {
      content: 'hello world', // defaults to an empty string
      owner: 'root' // defaults to the current user
    }
  }
})

args

This is the output of yargs-parser.

session

A object contains the following keys:

{
  env: {
    // key=value of environmental variables
  },
  commands: {
    // path=command of all available commands
  },
  api: {
    exec: (line, { hidden: false }), // call this function with a line of shell
      // input to execute commands, pass hidden: true if you do not wish the
      // command to be echoed to the screen or added to the history
    print: (line) // call this function to add output to the screen
  },
  fs: {
    // call functions here to manpiulate the filesystem directly
    getNode: (path, session), // return a fs node
    mkdir: (path, session, { uid, gid, perms, parents }), // create a directory
      // node with the passed uid, gid and perms - parents: true will created
      // intermediate directories
    write: (path, content, session, { uid, gid, perms, parents }), // create a
      // file node with the passed uid, gid and perms - parents: true will
      // created intermediate directories
    read: (path, session), // read file contents
    rm: (path, session, { recursive }) // remove an fs node
  }
}

Acknowledgements

What's in a name?

Big up Green Lungs and the Arachnid Egg Sac Crew in Isleworth, easy. Big up Baron Bin Man, easy. Keep it locked on, Ursa Minor, easy. Big up the Terminatorator, easy. Big to Susan and Timothy in Barnes, easy. Boi, you know it! I can't stop! T-WOG$ RIP.