Package Exports
- snipify
Readme
Snipify πΈ
Snipify is a production-ready toolkit for capturing, resizing, and exporting high-quality web screenshots using Puppeteer and Sharp.
"From page to pixel-perfect screenshotβautomate it all." π
π Features
- Full & Viewport Modes β Capture the entire page or just the visible area
- Custom Device Emulation β Desktop, mobile, tablet & more with custom user-agents
- Smart Resource Blocking β Skip heavy/irrelevant assets like analytics & media
- Image Processing with Sharp β Resize, crop, compress effortlessly
- Pure TypeScript β Strictly typed and modern API
- No Bloat β Minimal dependencies, fast and efficient
π¦ Installation
npm install snipify
# or
yarn add snipify
# or
bun add snipifyπ Quick Start
import { captureScreenshot } from "snipify";
const { base64 } = await captureScreenshot("https://example.com", "desktop", {
mode: "full",
format: "jpeg",
quality: 80,
});β¨ Core API
πΈ captureScreenshot(url, device?, options?)
Capture a screenshot and get a base64 string.
const result = await captureScreenshot("https://example.com", "mobile", {
mode: "viewport",
format: "png",
});Parameters
| Name | Type | Description | ||
|---|---|---|---|---|
url |
string |
Web page URL | ||
device |
`'desktop' \ | 'mobile' \ | 'tablet' ...` | Emulated device (default: desktop) |
options |
{ mode, format, quality, ... } |
Screenshot options |
π Resize Options
You can resize screenshots automatically:
await captureScreenshot("https://example.com", "desktop", {
mode: "full",
fixedSize: { width: 800, height: 600 },
});βοΈ Options
interface ScreenshotOptions {
format?: 'png' | 'jpeg';
quality?: number;
mode?: 'full' | 'viewport';
waitForSelector?: string;
delay?: number;
headless?: boolean;
blockResources?: boolean;
clip?: { x: number; y: number; width: number; height: number };
fixedSize?: { width: number; height: number };
}π§ Why Snipify?
- Production Ready β Battle-tested setup with error handling
- Fast β Puppeteer + Sharp combo for fast, clean output
- Zero UI Dependency β Works anywhere Node.js runs
- Typed First β Built for TypeScript users
- Modular β Customize device presets, screenshot settings & more
π οΈ Contributing
git clone https://github.com/kiron0/snipify.git
cd snipify
bun install
bun run buildIssues and PRs are warmly welcome π€
π License
MIT Β© Toufiq Hasan Kiron
βSnip it. Sharpen it. Ship it.β β Snipify Motto πΈ