View on GitHub


The power of Unix command line tools ported to Javascript

Download this project as a .zip file Download this project as a tar.gz file


The unix-toolbox.js is a port of many popular Unix command line tools to Javascript using Mozilla's emscripten project. It runs completely on the client-side and requires WebWorker support in the client's browser.

Currently Supported Commands


The Javascript class Interface can be used to initiate a WebWorker and communicate with it.. This is an example from ImageMagick's convert tool that loads some XML files required by ImageMagick and then loads the image test.png, rotates it and converts it to JPEG format:

<script src="toolbox-base/interface.js"></script>
  var convert = new Interface('convert-worker.js');

  // print convert output to console
  convert.on_stdout = function(txt) { console.log(txt); };
  convert.on_stderr = function(txt) { console.log(txt); };

  // load ImageMagick's configuration files
  convert.mkdir('/', 'usr/local/etc/ImageMagick').then(function() {
    convert.addUrl('./src/config/magic.xml',   '/usr/local/etc/ImageMagick', 'magic.xml');
    convert.addUrl('./src/config/coder.xml',   '/usr/local/etc/ImageMagick', 'coder.xml');
    convert.addUrl('./src/config/policy.xml',  '/usr/local/etc/ImageMagick', 'policy.xml');
    convert.addUrl('./src/config/english.xml', '/usr/local/etc/ImageMagick', 'english.xml');
    convert.addUrl('./src/config/locale.xml',  '/usr/local/etc/ImageMagick', 'locale.xml');
    convert.addUrl('./src/config/delegates.xml',  '/usr/local/etc/ImageMagick', 'delegates.xml');

    // load image to convert
    convert.addUrl('demo/test.png', '/', 'test.png');

    convert.allDone().then(function() {'-rotate', '90', '/test.png', '/test-rotated-90.jpg').then(function() {
        convert.getFile('/', 'test-rotated-90.jpg').then(function(contents) {

          var img = document.createElement("img");
          img.src = "data:image/jpeg;base64,"+window.btoa(contents);

          var body = document.getElementsByTagName("body")[0];