Skip to content

ShotsnapWebsite screenshot API for Node.js

Screenshot any URL from Node.js without installing Puppeteer or Chrome.

Shotsnap logo

Screenshot a URL in Node.js ​

Shotsnap sends the URL to a hosted cloud browser at shotsnap.vercel.app, which loads the page and returns a PNG. You get the image as a Buffer and can write it to a file in the same call.

javascript
import { takeScreenshot } from "shotsnap";

const image = await takeScreenshot({
  pageUrl: "https://example.com",
  saveFile: true,
  fileName: "example.png",
});

The same screenshot API answers plain HTTP requests, which the screenshot guide covers along with the library.

When to use it ​

Shotsnap fits jobs where you need a picture of a public web page and nothing more: a link preview in a chat bot, a thumbnail for a bookmark list, a visual record in a small script or a serverless function where bundling a browser binary is awkward. The package exports a single function, so there is little to learn.

If you need to click, log in, capture a single element or reach a site on localhost, run a browser yourself. The Puppeteer comparison shows both approaches side by side.

How it works ​

takeScreenshot builds a GET request to https://shotsnap.vercel.app/api/screenshot with the page URL and the screen size, then waits for the response. The browser runs on the hosted service, not on your machine. When the image arrives, the function turns it into a Node.js Buffer. With saveFile: true it also writes the Buffer to disk before returning it.

OptionDefaultPurpose
pageUrlnoneThe page to capture
screenWidth800Viewport width in pixels
screenHeight768Viewport height in pixels
saveFilenoneWrite the image to disk when set
fileNameshotsnap.pngWhere the image is written

The Props page describes each option in detail.

Things to know ​

  • Every call depends on the hosted API. Heavy use can be rate-limited, and some sites block the API's IP address.
  • Only public URLs work, because the page is loaded from the hosted service.
  • The package is written in TypeScript, compiled to CommonJS, and works from both require and import.

Ready to try it? Start with Getting Started.

Released under the MIT License.