6.0.2 • Published 9 years ago

url2png v6.0.2

Weekly downloads
133
License
BSD
Repository
github
Last release
9 years ago

node.js library for url2png

Get your account at http://url2png.com/

Installation

$ npm install url2png

Usage

var url2png = require('url2png')('API_KEY', 'PRIVATE_KEY');

var screenshotUrl = url2png.buildURL(url, options);

var screenshotStream = url2png.readURL(url, options);

Params

Url

The target url as a string.

Options

Samples

var url2png = require('url2png')('API_KEY', 'PRIVATE_KEY');

var options = {
  viewport : '900x600',
  thumbnail_max_width : 400,
  protocol: 'http'
}

//Get the URL
var url = url2png.buildURL('google.com' options);

//...or download the image to a file
var fs = require('fs');
url2png.readURL('google.com' options).pipe(fs.createWriteStream('google.png'));

//...or send the image in the http response
var http = require('http');
http.createServer(function (req, res) {
  if (req.url === '/google.png') {
    url2png.readURL('google.com' options).pipe(res)
  }
});