请检查date=中的日期值 (帮助) @cf-wasm/resvg
一个高性能的SVG渲染器和工具包,由Rust基于restg提供动力.
电源 (原始内容存档于2018-09-21) (英语). resvg-js。 。 。 .
安装
npm install @cf-wasm/resvg # npm
yarn add @cf-wasm/resvg # yarn
pnpm add @cf-wasm/resvg # pnpm
使用量
因为 package.json 包括: node, (中文(简体) ), workerd,以及 edge-light,通常可以直接从 @cf-wasm/resvg 让运行时间选择正确的入站点 :
import { Resvg } from "@cf-wasm/resvg";
如果您想要明确, 请从子模块导入 :
-
Cloudflare Workers / Pages (Wrangler): 云花工/页面(英语:
import { Resvg } from "@cf-wasm/resvg/workerd"; // To use v2.4.1 of @resvg/resvg-wasm, use the below instead import { Resvg } from "@cf-wasm/resvg/legacy/workerd"; -
Next.js Edge 运行时间 :
import { Resvg } from "@cf-wasm/resvg/edge-light"; // To use v2.4.1 of @resvg/resvg-wasm, use the below instead import { Resvg } from "@cf-wasm/resvg/legacy/edge-light"; -
节点.js(内含):
import { Resvg } from "@cf-wasm/resvg/node"; // To use v2.4.1 of @resvg/resvg-wasm, use the below instead import { Resvg } from "@cf-wasm/resvg/legacy/node";
文档
建议使用 Resvg.async() 作为静态方法代替 new Resvg() 构造器 :
import { Resvg } from "@cf-wasm/resvg/legacy/node";
// this is recommended
await Resvg.async("<svg...</svg>");
// instead of
new Resvg("<svg...</svg>");
API 参考文献改为: (原始内容存档于2018-09-21) (英语). resvg-js。 。 。 .