Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Pipe stdin to Phantom.JS
JavaScript HTML Shell Makefile


latest commit 109b2a2fbd
@mantoni authored
Failed to load latest commit information.
bin add ssl errors
lib add ssl errors
test add missing test
.gitignore Added Browserify as a devDependency
.jslintrc Added .jslintrc 1.2.0
LICENSE Initial commit
Makefile Fix tests and make fix ssl error documentation
package.json 1.2.0


SemVer License

  • Pipes stdin to PhantomJS
  • Writes script console output to stdout
  • Writes script errors to stderr
  • Exit code 0 if nothing threw, otherwise 1


npm install -g phantomic


Phantomic does not include PhantomJS itself. Make sure the phantomjs executable is in your PATH or specify with --phantomjs.

Usage: phantomic [options] [file]

    --debug                Launch the WebKit debugger in a browser
    --port <num>           Explicit port binding for temporary web server. If
                           no port is specified, a random free port is used.
    --phantomjs <path>     Use specified phantomjs binary
    --web-security <bool>  Enables PhantomJS web security and forbids
                           cross-domain XHR (default is true)
    --brout                Assume brout is part of the JS
    --ignore-ssl-errors <bool>  Tell PhantomJS to ignore SSL certificate errors
                                when network requests are made (default is false)

Pipe any script to phantomic:

phantomic < ./test.js

Opening a file:

phantomic ./test.js

If you are using phantomic from a Makefile with a local install, you will have to include it in the PATH:

BIN = ./node_modules/.bin
PATH := $(BIN):$(PATH)

  browserify ./test.js | phantomic


Put a debugger; statement somewhere and run:

phantomic --debug < ./test.js

This will open the WebKit inspector in your browser.

Exit detection

By default, phantomic will report an error if anything was logged to console.error. Program termination is detected by observing delays in the event queue and the last log statement that was received.

To make exit detection more reliable, brout can be used. If brout is part of the given script, run phantomic with --brout to install handlers for the out, err and exit events. Also make sure process.exit(code) is called.


You can use phantomic from your own node scripts like this:

var phantomic = require('phantomic');

phantomic(process.stdin, {
  debug : false,
  port  : 0,
  brout : false,
  'web-security': false,
  'ignore-ssl-errors': true
}, function (code) {

Run the test cases

npm install


  • Node 0.10 or later
  • PhantomJS 1.9



Something went wrong with that request. Please try again.