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

phantom.net

v0.5.1

Published

run phantomjs as a network service.

Downloads

8

Readme

phantom.net

For nodejs developers wanting to run phantomjs as a network service. Includes both server and client library.

server

start a phantom.net service on port 5000.


var phantom = require('phantom.net')

var server = new phantom.Server(5000)

client

connect to service and render web page as pdf.

var phantom = require('phantom.net')

var client = new phantom.Client('http://localhost:5000')

var parameter = {url: 'http://google.com', mime: 'application/pdf'}

client.render(parameter, function(readstream) {
	
	// do something with the stream.
})

install

npm install phantom.net

note: phantomjs needs to be installed on the server machine, and set up as a PATH environment variable.

contents

phantom.net was written specifically for developers looking to expose phantomjs as a network service. The library allows developers to quickly host phantomjs as a http accessible endpoint, and pass it urls and content to render. phantom.net will respond with readable streams. Useful for writing results to disk, or back out as http response.

var phantom = require('phantom.net')

var client = new phantom.Client('http://localhost:5000')

var parameter = {url: 'http://google.com', mime: 'application/pdf'}

client.render(parameter, function(readstream) {
	
	var writestream = require('fs').createWriteStream('output.pdf')	

	readstream.pipe(writestream)
})

The client render() method accepts a single parameter which is passed to phantomjs for rendering. Below is the parameter definition. When passing this parameter, either url or content must be set. The mime is required, and can be either 'application/pdf', image/jpg', 'image/png' or 'image/gif'

note: for more details on the following properties, see here.

interface Parameter {
    
    content?   : string
	
    url?       : string
        
    mime       : string

	timeout?   : number
	
    viewportSize? : { 
        
        width   : number 
    
        height  : number 
    }
    
    paperSize? : {
        
        width?      : number

        height?     : number

        border?     : string

        format?     : string

        orientation?: string
    }
    
    zoomFactor?  : number

    clipRect? : { 

        top   : number

        left  : number 

        width : number

        height: number 
    }
}

var phantom = require('phantom.net')

var server  = new phantom.Server(5001)

var client  = new phantom.Client("http://localhost:5001")

require('http').createServer(function(req, res) {
	
	var parameter = {url: 'http://google.com', 
					 mime: 'application/pdf', 
					 viewportSize: { width: 1600, height: 1200 } }
	
	client.render(parameter, function(errors, stream) {
		
		res.writeHead(200, {'Content-Type' : parameter.mime})
		
		stream.pipe(res)
	})

}).listen(5000)

console.log('server listening on port 5000')

If running the server on a windows machine, rendering may take a considerable amount of time. If this is a issue, you can speed things up unchecking 'automatically detect settings' in internet explorers LAN settings, as follows...

  • open up internet explorer.
  • options > internet options > connections (tab).
  • uncheck 'automatically detect settings'.
  • click ok.