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

screenerx

v1.1.1

Published

Batch create screenshots of websites

Downloads

6

Readme

Screenerx

This nodejs project will create batch screenshots of websites. It uses the awesome puppeteer library which uses a real browser under the hood, e.g. a Chrome or Firefox.

Installation

npm install -g screenerx
# or:
yarn global add screenerx
# or use docker (see below)

Usage

Use arguments

You can call screenerx with arguments:

Examples

# create a screenshot with default settings
screenerx --url https://example.com

# set width and height
screenerx --url https://example.com --width=1200 --height=800

# create a full page screenshot
screenerx --url https://example.com --width=1200 --height=full

# set output path
screenerx --url https://example.com --width=1200 --height=800 --output-path=screenshots/test

# set output file (if not set, the url will be used)
screenerx --url https://example.com --width=1200 --height=800 --output-path=screenshots/test --output-file=example.jpg

# pass an url via stdin (e.g. from a file or echo)
echo "https://example.com" | xargs -I {} ./screenerx.js --url={}
 
# create screenshots in parallel (using gnu-parallel) with 4 threads: 
cat links.txt | parallel --line-buffer -j 4 screenerx --url {}

# docker example (see below for more information)
cat links.txt | parallel --line-buffer -j 4 docker-compose run --rm screenerx --url {}

# specify a link file, default is links.txt (link file is ignored if you specify an url!)
screenerx --file=links.txt

Create a config file

If you like, you can also create a config file. The config file will be used to generate the screenshots.

create a file called screenerconf.json, you can see at screenerconf.json.example for an example. An entry looks basically like this:

{
    "linkFile" : "links.txt",
    "tasks": [
        {
            "name" : "test_landscape",
            "enabled" : true,
            "baseUrl" : "https://www.example.com",
            "linkFile" : "links.txt",
            "browser" : "chrome",
            "width" : "1920",
            "height" : "1080"
        }
    ]
}

| prop | description | |----------|-----------------------------------------------------------------------------------------------------------------| | name | name of the task, this will be used in directory name | | enabled | should this task run? | | baseUrl | if you specify a baseUrl, you can use paths only in your urlfile | | browser | chrome, firefox, etc.. Default is chrome, if you need another browsers, see puppeteer docs how to install these | | width | width of the screen | | height | height of the screen, can be also "full" to create full size screenshots | | linkFile | set a different link file for this job |

create a text file and put your links into that file. For example links.txt (as specified above in json) The link list can be a normal list with full URLs starting with http://, https:// or you can also only specify the paths. for example /about. The full URL will be generated out of provided baseUrl in screenerx.conf.json and the provided path in links.txt You can specify the linkFile in the root of the json file, but you can also specify / override it in the task itself.

The screenshots will be made in the screenshot folder.

Docker

You can also use this tool in a docker container. Just build the container with docker build -t screenerx . and run it with docker run -it --rm -v $(pwd):/app/screenshots screenerx

or use the docker-compose file:

docker-compose run --rm screenerx

License

MIT

Author

Michael Milawski