Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including phantom-bluebird with all npm packages installed. Try it out:

var phantomBluebird = require("phantom-bluebird")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

phantom-bluebird v0.0.2

Core phantom modules promisified with bluebird


Core phantom modules promisified with bluebird


npm install phantom-bluebird --save

It is NOT a node module.

This module can be used in phantomjs scripts to use promise api instead of non-standard callback api of phantomjs modules.

webpage module

Same as phantomjs webpage module, but method open is promisified.

// replaces webpage and child_process with modules from this package.
// don't call this function if you don't want core modules replaced.

var webpage = require('webpage');
// or var webpage = require('phantom-bluebird/lib/webpage');
// or var webpage = require('phantom-bluebird').webpage;

var page = webpage.create();'')
.then(function (status) {
    console.log('Page title:', page.title);
.catch(function (err) {
    console.log('Can\'t open page');
.finally(function() {

Only open method of page object is promisified at the moment.

child_process module

Same as phantom child_process module, but methods are promisified.

spawn method supports additional options (see example below).

var spawn = require('child_process').spawn;
// or var spawn = require('phantom-bluebird/lib/child_process').spawn;

spawn('node', ['--harmony', 'app'], {
    log: true,
    // with this option child process stdout and stderr are logged to console
    startedLog: 'started'
    // promise will resolve when child process logs string containing "started"
    // without 'startedLog' option, promise will resolve immediately
.then(function (child) {
    console.log('app started'); = child;
.then(function () {
    // ... do something, e.g. open page
.finally(function () {;

TODO: example for execFile method.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free