Sign In

@corralimited/snapdiff

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@corralimited/snapdiff

Typed TypeScript client for the SnapDiff REST API. Visual diffs, screenshots, project baselines. Generated from the official OpenAPI spec — every method is fully typed end-to-end.

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

@corralimited/snapdiff

Typed TypeScript client for the SnapDiff REST API. Visual diffs, screenshots, project baselines.

npm install @corralimited/snapdiff

Quickstart

import { Snapdiff } from '@corralimited/snapdiff';

const sd = new Snapdiff({ apiKey: process.env.SNAPDIFF_API_KEY! });

// Ad-hoc visual diff between two URLs
const result = await sd.diff({
  before: 'https://example.com',
  after: 'https://staging.example.com',
});
console.log(`${result.diff_percentage}% changed`);
console.log(result.diff_image_url);

// Compare against a stored project baseline
const baseline = await sd.diffBaseline({
  project: 'acme-marketing',
  page_name: 'pricing',
  after: 'https://staging.acme.com/pricing',
});

// Single screenshot
const shot = await sd.screenshot({ url: 'https://example.com', full_page: true });

// Project management
const projects = await sd.projects.list();
const project = await sd.projects.get('prj_xxx');

Errors

Non-2xx responses throw SnapdiffError:

import { Snapdiff, SnapdiffError } from '@corralimited/snapdiff';

try {
  await sd.diffBaseline({ project: 'unknown', page_name: 'home', after: '...' });
} catch (err) {
  if (err instanceof SnapdiffError) {
    console.error(err.status, err.message); // 404 'Project "unknown" not found'
  }
}

Escape hatch

For operations without an ergonomic helper, every endpoint is reachable through the typed openapi-fetch client:

const { data, error } = await sd.client.POST(
  '/projects/{projectId}/builds/{buildId}/approve',
  { params: { path: { projectId: 'prj_xxx', buildId: 'bld_xxx' } } },
);

Path, query, body, and response types are all inferred from the OpenAPI spec.

Configuration

OptionDefaultNotes
apiKeyRequired. Get one at https://snapdiff.ai/dashboard
baseUrlhttps://api.snapdiff.ai/v1Override for self-hosted or testing.
fetchglobalThis.fetchInject a custom fetch (Node 18+, undici, polyfill).

License

MIT — see LICENSE.

Keywords

snapdiff

FAQs

Package last updated on 14 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts