Capture screenshots in CoffeeScript
Add screenshot and scrolling GIF capabilities to your CoffeeScript applications with clean, readable syntax. Compiles to JavaScript, no headless browsers to manage.
Installation
- 1Use Node.js 18+ (includes native fetch)
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your fetch requests
Authentication
Include your API key in the X-KEY header with every request:
response = await fetch url, headers: 'X-KEY': 'your-api-key' buffer = Buffer.from await response.arrayBuffer()
CoffeeScript Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
fs = require 'fs/promises' response = await fetch 'https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png', headers: 'X-KEY': 'your-api-key' buffer = Buffer.from await response.arrayBuffer() await fs.writeFile 'screenshot.png', buffer
fs = require 'fs/promises' response = await fetch 'https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out', headers: 'X-KEY': 'your-api-key' buffer = Buffer.from await response.arrayBuffer() await fs.writeFile 'animation.gif', buffer
Response Format
On success, the API returns the image binary data directly in the response body.
| Status Code | 200 OK |
| Content-Type | image/png, image/jpeg, or image/gif |
| Body | Binary image data (Buffer) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
Just use native fetch API. No Puppeteer or browser installations required.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
CoffeeScript Integration
Clean, expressive syntax. Works with any CoffeeScript project in Node.js or browser environments.
Rich Features
Custom viewport sizes, full page capture, PNG/JPEG formats, scrolling GIFs with 15 easing functions.
Frequently Asked Questions
Do I need to install any browser dependencies?
No. Scrnpix runs browsers on our infrastructure. You only need Node.js 18+ with native fetch.
Can I use this with CoffeeScript in the browser?
Yes. The fetch API works in both Node.js and modern browsers after CoffeeScript compilation.
How do I handle errors in CoffeeScript?
Use try-catch blocks (try/catch in CoffeeScript). Check response.ok for HTTP success status.
What CoffeeScript version is required?
CoffeeScript 2.x with async/await support. The API is a simple HTTP GET request.
Ready to capture screenshots in CoffeeScript?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free