SDKS AND TOOLS

The Node.js SDK

@vecsnap/sdk turns an image into an SVG in one call, waits through a slow one, and checks your webhooks. No dependencies; Node 20 and later, Deno, Bun and edge runtimes.

Install
npm install @vecsnap/sdk
Node.js
import { readFile, writeFile } from "node:fs/promises";
import { VecSnap } from "@vecsnap/sdk";

const vecsnap = new VecSnap(); // reads VECSNAP_API_KEY
const result = await vecsnap.vectorize({ file: await readFile("logo.png"), filename: "logo.png" });
await writeFile("logo.svg", await vecsnap.download(result));
console.log(`${result.result?.anchorPoints} anchor points`);

What it does for you

  • vectorize() sends a file as a form, and when the API answers 202 it waits, then asks for the files.
  • Every refusal is a VecSnapError with code, status and requestId. Past a 202 it also carries conversionId and idempotencyKey: call again with that key to pick the same conversion up.
  • verifyWebhook(rawBody, headers, secret) checks an event your server received.
  • Every other operation: vecsnap.api.<operationId>(), generated from the API's document.