{"_id":"@c0b41/webshot","_rev":"2-50301622a24375dbdd7d869239b56129","name":"@c0b41/webshot","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@c0b41/webshot","version":"1.0.0","description":"Easy website screenshots","author":{"name":"Brenden Kokoszka"},"contributors":[{"name":"Brenden Kokoszka","email":"brenden.kokoszka@gmail.com"},{"name":"Matthew Chase Whittemore","email":"mcwhittemore@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/c0b41/node-webshot.git"},"dependencies":{"graceful-fs":"~3.0.6","cross-spawn":"^0.3.0","tmp":"~0.0.25","phantomjs":"~1.9.16"},"optionalDependencies":{"phantomjs":"~1.9.16"},"devDependencies":{"imagemagick":"git://github.com/rsms/node-imagemagick.git","mocha":"*","should":"*"},"main":"./lib/webshot.js","scripts":{"test":"mocha --ui bdd --reporter spec --require should --globals i ./test/tests.js"},"keywords":["screenshot","screengrab"],"gitHead":"ed4ea9dcefbda6e7b7e5d521ec2f3a936dfef6be","bugs":{"url":"https://github.com/c0b41/node-webshot/issues"},"homepage":"https://github.com/c0b41/node-webshot#readme","_id":"@c0b41/webshot@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.4","_npmUser":{"name":"c0b41","email":"c0b41@yandex.com.tr"},"dist":{"integrity":"sha512-zUCeCqJ40Q0e0KZ3I2UXYHgybOu9wb9up61w1zCPLun6VWuUxJi8KHddONFBnKHrlmnsexN+6DjSsou++oVjcw==","shasum":"355601338d27230f82f2b66071ffb31bbdfd71cc","tarball":"https://registry.npmjs.org/@c0b41/webshot/-/webshot-1.0.0.tgz","fileCount":5,"unpackedSize":24589,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx2CsCRA9TVsSAnZWagAAhiAP/0m4ttIKHt+6i2m8Bp3q\nW7vzqINoQZnxyMxe+oND2ZgNVzdEnar3ndkRXzOfXhwEPAw8EHyTK0xXo3+B\nS2qjQ99eAdsVu5MhG8Ii+cdUyjrFuVAHAplNc4mxX0eoqcDG/pXcT/0uUrb5\n3SPE2Qz5iGgMuTPJp4v+blXgZPF+rOxY81sUyu+akv65E4baEgl5CNtAG16j\ncqXXLB/BrafXqNd4/ZokdXaHCgW6QLBEuTWMLz/++Z8kcG4uBNp+Ley5KWzv\nwi5lTn4Pf3/weIPgoNVivMhfHHViRaDu2tmYZPK87i0yuiJSXxy6Z7mW7vUU\nVYXSM9AjSiNdUJoNWOU70kwjS2JzHeGa21oko7yqIrl6Rla1ER1ahv+5VmzS\nJR5EOdP4E6B+RSOZPUCgqQ5h6D+2yimfWzgDJvyeNbRVaYomEr7evn1+xKHN\nNooegX8tc41w8mZGTiCF9K0aAi8MCDo5GVd3mj3IDyFknqIWciCj3v0+O5Z1\noQ8MHrbk95hq/8LK1gKOgwEpmaL/F8pJlRW2Mf5IP8Ob5NnOVXJRufiRIEZ4\n1WASDyATfJhSBirvLAKmt+m+t1aoovqmd0S30W+FkMYzippwN4IErQqTWzDl\nuetFhR25bgjUSRNhYpdfrbh0BielH0pxMi1WSIMr4wiNy0Od41ayRX6opw61\nN4FW\r\n=v7Ta\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDeuyFBWFz7duX2CH86C0O5Qb7IpfktVSgH4d3Xm3fqNwIgHMVFH41+zNcHtvT2jtkii6LI7I+mbxv8eBmH9tO35fI="}]},"maintainers":[{"name":"c0b41","email":"c0b41@yandex.com.tr"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webshot_1.0.0_1539793067794_0.23318508166004537"},"_hasShrinkwrap":false,"deprecated":"Depraceted"}},"time":{"created":"2018-10-17T16:17:47.625Z","1.0.0":"2018-10-17T16:17:47.903Z","modified":"2022-04-04T21:23:56.092Z"},"maintainers":[{"name":"c0b41","email":"c0b41@yandex.com.tr"}],"description":"Easy website screenshots","homepage":"https://github.com/c0b41/node-webshot#readme","keywords":["screenshot","screengrab"],"repository":{"type":"git","url":"git+ssh://git@github.com/c0b41/node-webshot.git"},"contributors":[{"name":"Brenden Kokoszka","email":"brenden.kokoszka@gmail.com"},{"name":"Matthew Chase Whittemore","email":"mcwhittemore@gmail.com"}],"author":{"name":"Brenden Kokoszka"},"bugs":{"url":"https://github.com/c0b41/node-webshot/issues"},"license":"MIT","readme":"# node-webshot\n\nWebshot provides a simple API for taking webpage screenshots. The module is a\nlight wrapper around PhantomJS, which utilizes WebKit to perform the page\nrendering.\n\n## Examples\n\nA simple url example:\n\n```javascript\nvar webshot = require('webshot');\n\nwebshot('google.com', 'google.png', function(err) {\n  // screenshot now saved to google.png\n});\n```\n\nAn html example:\n\n```javascript\nvar webshot = require('webshot');\n\nwebshot('<html><body>Hello World</body></html>', 'hello_world.png', {siteType:'html'}, function(err) {\n  // screenshot now saved to hello_world.png\n});\n```\n\nAlternately, the screenshot can be streamed back to the caller:\n\n```javascript\nvar webshot = require('webshot');\nvar fs      = require('fs');\n\nwebshot('google.com', function(err, renderStream) {\n  var file = fs.createWriteStream('google.png', {encoding: 'binary'});\n\n  renderStream.on('data', function(data) {\n    file.write(data.toString('binary'), 'binary');\n  });\n});\n```\n\nAn example showing how to take a screenshot of a site's mobile version:\n\n```javascript\nvar webshot = require('webshot');\n\nvar options = {\n  screenSize: {\n    width: 320\n  , height: 480\n  }\n, shotSize: {\n    width: 320\n  , height: 'all'\n  }\n, userAgent: 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us)'\n    + ' AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g'\n}\n\nwebshot('flickr.com', 'flickr.jpeg', options, function(err) {\n  // screenshot now saved to flickr.jpeg\n});\n```\n\n## Options\nAn optional `options` object can be passed as the parameter directly preceding\nthe callback in a call to webshot.\n\n<table>\n  <thead>\n    <tr>\n      <th>Option</th>\n      <th>Default Value</th>\n      <th>Description</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>windowSize</th>\n      <td>\n<pre>{ width: 1024\n, height: 768 }</pre>\n      </td>\n      <td>The dimensions of the browser window. <em>screenSize</em> is an alias\n      for this property.</td>\n    </tr>\n    <tr>\n      <th>shotSize</th>\n      <td>\n<pre>{ width: 'window'\n, height: 'window' }</pre>\n      </td>\n      <td>The area of the page document, starting at the upper left corner, to\n      render. Possible values are 'screen', 'all', and a number defining a\n      pixel length.\n      <br /> <br />\n      <strong>'window'</strong> causes the length to be set to the length of\n      the window (i.e. the shot displays what is initially visible within the\n      browser window).\n      <br /> <br />\n      <strong>'all'</strong> causes the length to be set to the length of the\n      document along the given dimension. </td>\n    </tr>\n    <tr>\n      <th>shotOffset</th>\n      <td><pre>{ left: 0\n, right: 0\n, top: 0\n, bottom: 0 }</pre></td>\n      <td>The left and top offsets define the upper left corner of the\n      screenshot rectangle. The right and bottom offsets allow pixels to be\n      removed from the shotSize dimensions (e.g. a shotSize height of 'all' with\n      a bottom offset of 30 would cause all but the last 30 rows of pixels on\n      the site to be rendered).</td>\n    </tr>\n    <tr>\n      <th>phantomPath</th>\n      <td>'phantomjs'</td>\n      <td>The location of phantomjs. Webshot tries to use the binary provided by\n      the phantomjs NPM module, and falls back to 'phantomjs' if the module\n      isn't available.</td>\n    </tr>\n    <tr>\n      <th>phantomConfig</th>\n      <td>{}</td>\n      <td>Object with key value pairs corresponding to phantomjs <a\n      href=\"https://github.com/ariya/phantomjs/wiki/API-Reference#command-line-options\">command\n      line options</a>. Don't include `--`. For example:\n      `phantomConfig: {'ignore-ssl-errors': 'true'}`</td>\n    </tr>\n    <tr>\n      <th>customHeaders</th>\n      <td>null</td>\n      <td>Any additional headers to be sent in the HTTP request.</td>\n    </tr>\n    <tr>\n      <th>defaultWhiteBackground</th>\n      <td>false</td>\n      <td>When taking the screenshot, adds a white background if not defined\n      elsewhere.</td>\n    </tr>\n    <tr>\n      <th>customCSS</th>\n      <td>''</td>\n      <td>When taking the screenshot, adds custom CSS rules if defined.</td>\n    </tr>\n    <tr>\n      <th>quality</th>\n      <td>75</td>\n      <td>JPEG compression quality. A higher number will look better, but creates\n        a larger file. Quality setting has no effect when streaming.</td>\n    </tr>\n    <tr>\n      <th>streamType</th>\n      <td>'png'</td>\n      <td>If streaming is used, this designates the file format of the streamed\n      rendering. Possible values are 'png', 'jpg', and 'jpeg'.  </td>\n    </tr>\n    <tr>\n      <th>siteType</th>\n      <td>'url'</td>\n      <td>siteType indicates whether the content needs to be requested ('url'),\n      loaded locally ('file'), or is being provided directly as a string\n      ('html').</td>\n    </tr>\n    <tr>\n      <th>renderDelay</th>\n      <td>0</td>\n      <td>Number of milliseconds to wait after a page loads before taking the\n      screenshot.</td>\n    </tr>\n    <tr>\n      <th>timeout</th>\n      <td>0</td>\n      <td>Number of milliseconds to wait before killing the phantomjs process\n      and assuming webshotting has failed.  (0 is no timeout.)</td>\n    </tr>\n    <tr>\n      <th>takeShotOnCallback</th>\n      <td>false</td>\n      <td>Wait for the web page to signal to webshot when to take the photo\n      using <code>window.callPhantom('takeShot');</code></td>\n    </tr>\n    <tr>\n      <th>errorIfStatusIsNot200</th>\n      <td>false</td>\n      <td>If the loaded page has a non-200 status code, don't take a screenshot, cause an error instead.</td>\n    </tr>\n  </tbody>\n</table>\n\n### PhantomJS version\nBy default this package installs PhantomJS 1.9.x. Several issues exist in this version that are fixed in v2, but v2 is not yet stable across all platforms. The `phantomPath` option can be used to get around this if you want to try a more recent PhantomJS version. See this issue: https://github.com/brenden/node-webshot/issues/100\n\n### Phantom page properties\nIn addition to these options, the following options can be specified and will be\npassed to the [Phantom page\nobject](https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage):\n`paperSize`, `zoomFactor`, `cookies`, `customHeaders`, and `settings`.\n\n### Phantom callbacks\nArbitrary scripts can be run on the page before it gets rendered by using any of\nPhantom's [page callbacks](https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#callbacks-list),\nsuch as `onLoadFinished` or `onResourceRequested`. For example, the script below\nchanges the text of every link on the page:\n\n```javascript\nvar options = {\n  onLoadFinished: function() {\n    var links = document.getElementsByTagName('a');\n\n    for (var i=0; i<links.length; i++) {\n      var link = links[i];\n      link.innerHTML = 'My custom text';\n    } \n  }\n}\n```\n\nNote that the script will be serialized and then passed to Phantom as text, so all\nvariable scope information will be lost. However, variables from the caller can be \npassed into the script as follows:\n\n```javascript\nvar options = {\n  onLoadFinished: {\n    fn: function() {\n      var links = document.getElementsByTagName('a');\n\n      for (var i=0; i<links.length; i++) {\n        var link = links[i];\n        link.innerHTML = this.foo;\n      } \n    }\n  , context: {foo: 'My custom text'}\n  }\n}\n```\n\n## Tests\nTests are written with [Mocha](http://visionmedia.github.com/mocha/) and can be\nrun with `npm test`. The tests use [node-imagemagick](http://github.com/rsms/node-imagemagick) and thus require\nthat the [imagemagick CLI tools](http://www.imagemagick.org) be installed.\n\n## Running on Heroku\n[See this comment.](https://github.com/brenden/node-webshot/issues/25#issuecomment-23019665)\n\n## Grunt\n[grunt-webshot](https://npmjs.org/package/grunt-webshot) is a Grunt wrapper for this package.\n\n## Gulp\n[gulp-webshot](https://www.npmjs.com/package/gulp-webshot) is a Gulp wrapper for this package.\n\n## CLI\n[webshot-cli](https://npmjs.org/package/webshot-cli) is a CLI interface for this package.\n\n## License\n```\n(The MIT License)\n\nCopyright (c) 2012 Brenden Kokoszka\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the 'Software'), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n","readmeFilename":"README.md"}