Convert an NPM package command-line program into a web page
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Run an NPM command-line program in the browser

You have a useful program from an NPM package. But you want to run it from the browser.

Browser Bin will bundle that program into a web page and Javascript files that does the same thing. CommonJS code is wrapped in RequireJS, and there is a virtual terminal.


I like to use follow to watch my Couch database updates.

$ env since=18 heartbeat=120s follow
Database confirmed:
Streaming response:
Retry since 26 after 1000ms

To run Follow via browser Javascript and HTML, use browser_bin:

$ git clone git://
$ cd follow
$ cat package.json # Looks like "cli.js" is the real "follow" command.
$ browser_bin cli.js

You're done! Publish the static files on the web and visit index.html.

$ cp -r browser_bin/ /var/www/

Now you can run Follow by visiting its URL. URL query parameters are accessible in process.env.

Porting Notes

Browser Bin is not magic. It just makes a web page that loads everything into the browser correctly. If you do Node stuff like open a file, obviously that will not work.

Browser Bin provides workalikes for some of the Node library: