Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

banquo-webfonts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

banquo-webfonts

A Node.js screenshotting library using PhantomJs.

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Banquo

Banquo builds off of Depict, a node library designed to use PhantomJS to take screenshots of interactive visualizations. Banquo is slightly different in that it is built to be called on a Node.js server and returns a base64-encoded version of the screenshot as jsonp, as opposed to saving the screenshot to a file.

As a result, Banquo doesn't run on the command line, as Depict does, but instead is called like the example below from another Node.js script.

NOTE: As of Banquo 0.3.0, it no longer requires you to install PhantomJs separately.

Installation

You'll generally install this as a dependency in your package.json.

npm install banquo --save

If you want to install it without adding it to your package.json, run the command above without --save.

Usage

You can set up your own service with banquo by cloning banquo-server.

Note: Banquo server uses an older version of Banquo. Pull request welcome.

Here's a basic standalone setup:

var banquo = require('banquo');

var opts = {
    mode: 'base64',
    url: 'america.aljazeera.com',
    viewport_width: 1440,
    delay: 1000,
    selector: '#articleHighlightList-0'
};

banquo.capture(opts, function(err, imageData){
    if (err) {
     console.log(err)
    }
    console.log(imageData);
});

Or if mode is save and scrape is true you get the body markup. This behavior will be standardized in future versions so that just by setting scrape to true you'll get a third argument of the bodyMarkup. Pull request welcome.

var banquo = require('banquo');

var opts = {
    mode: 'save',
    url: 'america.aljazeera.com',
    viewport_width: 1440,
    delay: 1000,
    selector: '#articleHighlightList-0',
    scrape: true
};

banquo.capture(opts, function(err, bodyMarkup){
    if (err) {
     console.log(err)
    }
    console.log(bodyMarkup);
});

Options

KeyRequiredDefaultOptionsDescription
modenobase64save or base64The former will save a file to the out_file location and return a success string callback. The latter will return the image as a base64 string.
urlyesnullStringThe website you want to screenshot.
viewport_widthno1440Number (Pixels)The desired browser width. Settings this to a higher number will increase processing time.
viewport_heightno900Number (Pixels)The desired browser height. Settings this to a higher number will increase processing time. May be useful with long scrolls in fixed height containers.
delayno1000Number (Milliseconds)How long to wait after the page has loaded before taking the screenshot. PhantomJS apparently waits for the page to load but if you have a map or other data calculations going on, you'll need to specify a wait time.
selectornobodyString (CSS selector)The div you want to screenshot.
css_hidenonullString (CSS selector)Any divs you want to hide, such as zoom buttons on map. Defaults to none.
out_fileno'./image_%Y-%m-%d.png'String (File path)The name and location of the image file you want to save. Defaults to image_ plus the ISO year, month, day.
user_agentnonullStringSet a custom user-agent string.
scrapenofalseBooleanIf set to true and mode is save will return the HTML as a string. Does not work if mode is base64.

FAQs

Package last updated on 23 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc