• Stars
    star
    417
  • Rank 103,829 (Top 3 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Capture screenshots in multiple browsers!

capture-screenshot

Capture screenshots in multiple browsers. One module, to rule them all!

build status

Browsers

  • Chrome Headless
  • Electron
  • PhantomJS
  • Firefox Headless

Usage

Capture 1024x768 screenshots of https://twitter.com/ in Chrome, Electron and PhantomJS:

const capture = require('capture-screenshot')
const fs = require('fs')

capture({ url: 'https://twitter.com/' })
  .then(imgs => {
    fs.writeFileSync('chrome.png', imgs.chrome)
    fs.writeFileSync('electron.png', imgs.electron)
    fs.writeFileSync('phantomjs.png', imgs.phantomjs)
  })
Chrome Electron PhantomJS
chrome electron phantomjs

API

capture({ url, browsers = ['chrome', 'electron', 'phantomjs'], width = 1024, height = 768 })

Capture a screenshot of url, returns a Promise which resolves with an Object of Buffers.

Options:

  • url Page url
  • browsers The browsers to test
  • width Viewport width
  • height Viewport height

Installation

$ npm install capture-screenshot

CI

If you use the electron browser, this project requires an xvfb setup to be running in your CI environment. For an example how to set one up, check out the .travis.yml. After that, no further setup is required however, as all the executables are installed automatically.

Related projects

Sponsors

This module is proudly supported by my Sponsors!

Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my Patreon. Not sure how much of my modules you're using? Try feross/thanks!

License

MIT

Copyright (c) 2017 Julian Gruber <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

review

Visual regression testing tool for responsive websites
JavaScript
909
star
2

browser-run

Run code inside a browser from the command line
JavaScript
428
star
3

multilevel

Expose a LevelDB over the network
JavaScript
352
star
4

travis-watch

Stream live travis test results of the current commit to your terminal!
JavaScript
293
star
5

multipipe

A better `Stream.pipe` that creates duplex streams and lets you handle errors in one place.
JavaScript
291
star
6

keypair

Generate a RSA PEM key pair from pure JS
JavaScript
274
star
7

tape-run

Headless tape test runner
JavaScript
224
star
8

npm-diff

Diff two versions of a node module
Shell
212
star
9

is-mobile

Check if mobile browser, based on useragent string.
JavaScript
200
star
10

brace-expansion

Brace expansion, as known from sh/bash, in JavaScript
JavaScript
175
star
11

binary-extract

Extract a value from a buffer of json without parsing the whole thing
JavaScript
152
star
12

vipe

Pipe in and out of $EDITOR
Shell
138
star
13

async-stream

The async stream spec
133
star
14

proxy-clone

ES6 Proxies based deep clone
JavaScript
128
star
15

isarray

Array#isArray for older browsers.
JavaScript
127
star
16

reconnect-core

Generic stream reconnection module.
JavaScript
125
star
17

electron-stream

Streaming wrapper around electron
JavaScript
124
star
18

balanced-match

Match balanced character pairs, like `{` and `}`
JavaScript
117
star
19

go-intersect

Find the intersection of two iterable values
Go
110
star
20

just-launch

Launch any browser, on any OS, with a fresh session!
JavaScript
91
star
21

read-file-action

Read file contents
JavaScript
79
star
22

level-store

A streaming storage engine based on LevelDB
JavaScript
75
star
23

require-rebuild

Patch `require()` to recompile a node module if it has been built for a different node version
JavaScript
75
star
24

anarchyos

AnarchyOS
73
star
25

jilla

A Jira client for lazy people
JavaScript
70
star
26

level-fs

node's fs module with leveldb as backend
JavaScript
61
star
27

backer

wip distributed backup / file mirroring tool
JavaScript
60
star
28

parse-gp5

Parser for the Guitar Pro 5 file format
JavaScript
60
star
29

stream

Node.js streams in the browser
HTML
58
star
30

capture-chrome

Capture screenshots using Chrome's new headless mode.
JavaScript
56
star
31

ghub.io

http://ghub.io/<package-name> redirects to a npm package's GitHub page, if available.
JavaScript
54
star
32

memdb

LevelUp + MemDown
JavaScript
51
star
33

multilevel-http

Access a leveldb instance from multiple processes via HTTP
JavaScript
50
star
34

level-pathwise

Turn a leveldb into one huge object of arbitrary size! Efficiently and atomically update and read parts of it!
JavaScript
48
star
35

links

Experimental content sharing and collaboration platform.
JavaScript
43
star
36

capture-electron

Capture screenshots using Electron
JavaScript
43
star
37

streamstache

Mustache + Streams for node and browsers.
JavaScript
43
star
38

url-to-screenshot

Capture screenshots using phantomjs
JavaScript
43
star
39

level-secondary

Secondary indexes for leveldb.
JavaScript
41
star
40

co-read

Consume a readable stream generator-style
JavaScript
40
star
41

http-responders

Zero-dependency http responders
JavaScript
39
star
42

go-binary-extract

Extract a value from a json blob without parsing the whole thing
Go
39
star
43

builtins

List of node.js builtin modules
JavaScript
38
star
44

level-schedule

Durable job scheduler based on LevelDB
JavaScript
37
star
45

dat.haus

The composable HTTP API to the dat network
JavaScript
37
star
46

supersize

make text as big as possible in its parent element
HTML
36
star
47

quicktron

Quickly load a script in an Electron window!
JavaScript
35
star
48

review-host

Host multiple reviews in one app server
JavaScript
34
star
49

enstore

In-memory persistence for streams
JavaScript
34
star
50

alrt.io

the code behind alrt.io
JavaScript
33
star
51

deploy-from-npm

Continuous deployment tool tailing npm
JavaScript
33
star
52

node-pv

A node.js implementation of the pv utility
JavaScript
33
star
53

validimir

Create validation functions
JavaScript
33
star
54

intersect

Find the intersection of two arrays
JavaScript
32
star
55

downloads-folder

Get the local downloads folder, for all major platforms
JavaScript
32
star
56

is-type

Type checking from node core.
JavaScript
30
star
57

level-trie

The TRIE data structure and search algorithm, on top of leveldb.
JavaScript
30
star
58

npm-clone

Clone a node module, install its dependencies and run its tests
JavaScript
29
star
59

collect-feedback

Collect realtime anonymous feedback through a website
HTML
27
star
60

merge-pull-request-action

A simple GitHub Action for merging pull requests
JavaScript
27
star
61

ci-watch

Stream live CI results of the current commit to your terminal!
JavaScript
26
star
62

electra

The simplest API for running code inside electron
JavaScript
26
star
63

hypercore-index

Linear asynchronous stateful indexing of a hypercore feed
JavaScript
25
star
64

download-chromium

Download Chromium!
JavaScript
25
star
65

subfs

Create subfilesystems that are rooted at a specific directory.
JavaScript
25
star
66

net-connect

Make tcp connections with a convenient api.
JavaScript
24
star
67

buffer-replace

Like String#replace(), except for buffers
JavaScript
24
star
68

co-level

LevelUp wrappers for "co"
JavaScript
24
star
69

nodeconfeu-13

my live coding
JavaScript
22
star
70

me

Markdown editor.
JavaScript
22
star
71

yo-css

yo-yo helper for inline css
JavaScript
22
star
72

co-wait

setTimeout generator style
JavaScript
22
star
73

find-pull-request-action

A GitHub Action for finding pull requests.
JavaScript
21
star
74

test-npm-dependants

Run the test suites of all modules depending on a given module.
JavaScript
21
star
75

reconnect-net

Reconnect a tcp stream when it goes down.
JavaScript
21
star
76

bisect-sorted-set

An in memory sorted set that uses binary search on numeric indexes to find values next to each other
JavaScript
20
star
77

native-modules

Report on the native node modules used by your application or module
JavaScript
20
star
78

util-promisify

Node 8's util.promisify, as a node module
JavaScript
20
star
79

level-sec

High-level API for creating secondary indexes
JavaScript
19
star
80

module-usage

See how a module is used in npm.
JavaScript
19
star
81

co-queue

A FIFO queue for co
JavaScript
19
star
82

sortable-hash

Hash arrays of numbers into sortable strings with variable precision loss.
JavaScript
19
star
83

json-heal

Heal a cut off json string to make it parseable again
JavaScript
19
star
84

tap-bail

Bail out when the first TAP test fails
JavaScript
18
star
85

role

Develop services as single processes, deploy them as multiple.
JavaScript
18
star
86

deep-access

Access nested object properties via strings.
JavaScript
18
star
87

running-death-overdrive

Listen to Running Death's album Overdrive
JavaScript
17
star
88

rating

Star rating widget
JavaScript
17
star
89

array-filter

Array#filter for older browsers.
JavaScript
17
star
90

nsq-stream

Streaming interface for nsq
JavaScript
16
star
91

tapedeck

[DEPRECATED] Execute tap(e) tests that require browsers...in your browser!
JavaScript
16
star
92

json-store

Simple json db for node
JavaScript
16
star
93

level-fs-browser

level-fs as drop-in fs replacement for the browser
JavaScript
15
star
94

get-user-media

Cross browser navigator.getUserMedia with a node api
JavaScript
15
star
95

npm-dependants

Get dependants of a module on npm.
JavaScript
15
star
96

travis-logs

Stream travis logs to your terminal!
JavaScript
15
star
97

co-each

Parallel forEach for generators
JavaScript
15
star
98

project.sh

Tools to navigate and manage source code repositories living on GitHub.
Shell
14
star
99

git-aliases

Commonly used git aliases for your shell
Shell
14
star
100

git-log

Git log stream using jsgit
JavaScript
14
star