Skip to content

Instantly share code, notes, and snippets.

@ducan-ne
Last active June 30, 2024 15:18
Show Gist options
  • Select an option

  • Save ducan-ne/88c1f4ce047b6cf2883f3b7c0138818f to your computer and use it in GitHub Desktop.

Select an option

Save ducan-ne/88c1f4ce047b6cf2883f3b7c0138818f to your computer and use it in GitHub Desktop.
resvg-mem-usage.js
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
import fs from 'node:fs/promises'
import { Resvg, initWasm } from '@resvg/resvg-wasm'
await initWasm(await fs.readFile(`${import.meta.dirname}/resvg.wasm`))
const resvg = new Resvg(`<svg width="1200" height="630" viewBox="0 0 1200 630" xmlns="http://www.w3.org/2000/svg">
<mask id="satori_om-id">
<rect x="0" y="0" width="1200" height="630" fill="#fff"/>
</mask>
<rect x="0" y="0" width="1200" height="630" fill="#fff"/>
<clipPath id="satori_cp-id-0">
<rect x="0" y="0" width="1200" height="630"/>
</clipPath>
<mask id="satori_om-id-0">
<rect x="0" y="0" width="1200" height="630" fill="#fff"/>
</mask>
<image x="0" y="0" width="1200" height="630"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment