@mpurusottamc/url2png
node.js API for the URL2PNG online service
Last updated 2 years ago by mpurusottamc .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mpurusottamc/url2png 
SYNC missed versions from official npm registry.

url2png

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 non-escaped string.

Options

Name type default description
viewport string 1280x1024 The viewport for the browser. Max is 4000x4000
fullpage boolean false Capture the entire page, even what is outside of the viewport.
thumbnail_max_width pixels - Maximum width of image returned. If not specified image return will be 1:1.
delay seconds - EXTRA delay in seconds to handle flash animation.
You probably don't need this!
We work hard to detect the right time to take the screenshot.
force boolean false Shall we use the cached version if it already exists?
protocol string - The protocol to use, can be 'https' or 'http'. Default 'https'.

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)
  }
});

Current Tags

  • 6.0.3                                ...           latest (2 years ago)

1 Versions

  • 6.0.3                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |