@siteping/screenshot-storage
v0.1.0
Published
Screenshot storage for Siteping — Cloudflare Images, any S3-compatible bucket, your database (Drizzle: PostgreSQL, Turso/libSQL), the local filesystem, memory, or your own backend
Maintainers
Readme
@siteping/screenshot-storage
Screenshot storage for the SitePing stores: upload screenshots to Cloudflare R2, AWS S3 or any S3-compatible bucket, Cloudflare Images, your database through Drizzle, or your disk, and keep only their URL in the feedback. No AWS SDK and no runtime dependency: it runs on Node, Bun, Deno and edge workers.
Install
npm install @siteping/screenshot-storageNode ≥ 20, or any runtime with the Fetch and Web Crypto APIs (the /filesystem entry needs Node). drizzle-orm is an optional peer, only for the /drizzle-pg and /drizzle-libsql entries.
Quick start
import { createScreenshotStorage } from "@siteping/screenshot-storage";
import { createS3ObjectStore } from "@siteping/screenshot-storage/s3";
const screenshotStorage = createScreenshotStorage(
createS3ObjectStore({
endpoint: `https://${process.env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com`,
bucket: "siteping-screenshots",
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
publicBaseUrl: "https://screenshots.example.com",
}),
);
// Prisma: createSitepingHandler({ prisma, screenshotStorage })
// Drizzle: createPgSitepingStore(db, { screenshotStorage })Every upload gets a fresh random key, delete only removes objects it created, and backends without a public URL are served from your app by createScreenshotServeHandler.
Documentation
Every backend, serving screenshots from your app, least-privilege credentials, options, delete semantics and custom backends: siteping.dev/docs/adapters/screenshot-storage.
