Skip to content
Back to skills

Sandbox Fabric

ASecurity

Build, parse, and rasterize SVG with Fabric.js (renderSVG, loadSVG, render)

  • 554 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 1, 2026
ai-agentsgonodeapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 1, 2026

npx -y skills add nodetool-ai/nodetool --skill sandbox-fabric --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sandbox Fabric?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sandbox Fabric
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nodetool-ai-sandbox-fabric/badge)](https://www.skillsdirectory.com/skills/nodetool-ai-sandbox-fabric)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sandbox-fabric
description: Build, parse, and rasterize SVG with Fabric.js (renderSVG, loadSVG, render)
---

# Fabric.js in the sandbox

Specifier: `@nodetool-ai/sandbox-fabric`. Import it at the top of the body.

## render — Canvas spec / JSON to image bytes

Renders a scene description (objects, dimensions, background color) to raster
image bytes (`Uint8Array`):

```js
import { render } from "@nodetool-ai/sandbox-fabric";

const imageBytes = await render({
  width: 800,
  height: 600,
  backgroundColor: "#f8fafc",
  objects: [
    {
      type: "rect",
      left: 100,
      top: 100,
      width: 200,
      height: 120,
      fill: "#3b82f6",
      rx: 10,
      ry: 10
    },
    {
      type: "textbox",
      left: 120,
      top: 140,
      text: "NodeTool & Fabric.js",
      fontSize: 20,
      fill: "#ffffff"
    }
  ]
}, { format: "png", multiplier: 1 });

return { image: imageBytes };
```

## renderSVG — Canvas spec / JSON to SVG string

Renders a scene specification directly into an SVG string:

```js
import { renderSVG } from "@nodetool-ai/sandbox-fabric";

const svgString = await renderSVG({
  width: 500,
  height: 500,
  backgroundColor: "#ffffff",
  objects: [
    {
      type: "circle",
      left: 250,
      top: 250,
      radius: 100,
      fill: "#ef4444"
    }
  ]
});

return { svg: svgString };
```

## toDataURL — Canvas spec to Data URL

Exports the scene as a base64 Data URL string:

```js
import { toDataURL } from "@nodetool-ai/sandbox-fabric";

const dataUrl = await toDataURL({
  width: 400,
  height: 300,
  objects: [
    { type: "rect", left: 50, top: 50, width: 100, height: 100, fill: "green" }
  ]
}, { format: "png" });

return { dataUrl };
```

## loadSVG — Parse SVG string into Fabric objects

Parses an SVG document into Fabric objects and canvas options:

```js
import { loadSVG, render } from "@nodetool-ai/sandbox-fabric";

const parsed = await loadSVG("<svg ...>...</svg>");
const imageBytes = await render({
  width: 600,
  height: 400,
  objects: parsed.objects
});

return { image: imageBytes };
```

## Gotchas

- **Host execution.** Fabric.js depends on canvas and DOM APIs that do not exist
  in the pure WebAssembly QuickJS guest. It runs on the host and passes plain
  serializable data across the sandbox boundary.
- **Dimensions are bounded.** Canvas dimensions are clamped to a maximum of 8192
  pixels to prevent excessive memory consumption.

Files in this skill

  • SKILL.md2.4 KB
  • package.json843 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.