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 🙏

© 2024 – Pkg Stats / Ryan Hefner

screenshot-phantom

v1.0.3

Published

Timing screenshots on the websites and output pictures files in Node.js

Downloads

8

Readme

screenshot-phantom

Websites screenshots timer in Node.js

中文README

Features

  • uses phantom.js
  • Screenshot output picture files
  • Multiple screenshots at the same time
  • simple api

Sketch

Regularly perform a screenshot task, the whole process of a task is: open the page => wait for resources to load => screenshots => close page => open the next page (if the screen at the same time multiple sites) ... ...

Install

npm install --save screenshot-phantom

Usage

const screenshot = require('screenshot-phantom');

screenshot({

  /*
   * Required: An array consist of websites
   */
  urls: [
    'http://google.com',
    'https://www.npmjs.com/'
  ],

  /*
   * Optional: Set the rule of screenshots timing
   * Convenient options: 'everyMinute' | 'everyHour' | 'everyDay' | 'everyWeek' | 'everyMonth'
   * or use the other options of package "node-schedule", such as '0 * * * * *' (see the "Links" for more details)
   */
  rule: 'everyMinute',

  /*
   * Optional: Set the viewport width of screenshots
   */
  width: 1024,

  /*
   * Optional: Set the viewport height of screenshots
   */
  height: 768,

  /*
   * Optional: Set the screenshots format (pdf|png|jpeg)
   */
  format: 'jpeg',

  /*
   * Optional: Set the time delay of screenshot after page loaded
   */
  timeout: 15000,

  /*
   * Optional: Set the quality of the screenshots (0-100)
   */
  quality: 75,

  /*
   * Optional: An array consist of screenshots files' prefix names that match the urls array by index, which means these two arrays have the same length
   */
  picNamePrefix: [...urls],

  /*
   * Optional: Define the path of the output screenshots
   */
  pathName: './pictures/'
});

Example 1

const screenshot = require('screenshot-phantom');

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com/'
  ]

});

or

const screenshot = require('screenshot-phantom');
const schedule = require('node-schedule');
const rule = new schedule.RecurrenceRule();
rule.second = 0;

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com/'
  ],
  rule

});

or

const screenshot = require('screenshot-phantom');
const rule = '0 * * * * *';

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com//'
  ],
  rule

});

The same result:

Example 2

const screenshot = require('screenshot-phantom');
const rule = '0 * * * * *';

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com/'
  ],
  picNamePrefix: [
    'Rose',
    'Jack'
  ]
  
});

Result:

Demo

$ npm demo

Links

https://github.com/node-schedule/node-schedule

Contributing

Contributions welcome.

Author

Jerome https://github.com/lvjinpeng0