@contentauth/c2pa-wasm

中文文档
0.14.0发布于 2026/11/05MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 33.3万

The WebAssembly wrapper for c2pa-rs that powers c2pa-web, built with wasm-bindgen. While these bindings can be used directly, most users will prefer the convenie

原始使用文档
文档目录5 节
  1. Installation
  2. Development
  3. Prerequisites
  4. Building
  5. Testing

c2pa-wasm

The WebAssembly wrapper for c2pa-rs that powers c2pa-web, built with wasm-bindgen. While these bindings can be used directly, most users will prefer the convenience of c2pa-web.

Installation

npm install @contentauth/c2pa-wasm

Development

Prerequisites

Ensure the repo-wide prerequisites are installed:

See the contributor prerequisites for details.

Then, install all of the following prerequisites:

Rust

The minimum supported Rust version is 1.96.0.

To install Rust via rustup:

curl https://sh.rustup.rs -sSf | sh

For more information, see Install Rust.

Additionally, you must install the wasm32-unknown-unknown target:

rustup target add wasm32-unknown-unknown

wasm-bindgen-cli

The wasm-bindgen-cli provides options to tweak JavaScript generated by wasm-bindgen.

For more information, see the wasm-bindgen-cli documentation.

cargo install [email protected]

[!IMPORTANT] The version of wasm-bindgen-cli must match the version of the wasm-bindgen dependency in Cargo.toml. A version mismatch will cause build failures with errors like "rust Wasm file schema version: X.X.X, this binary schema version: Y.Y.Y". If you encounter this, check Cargo.toml for the correct version and reinstall the CLI accordingly.

wasm-pack

Wasm-pack is a tool for building and working with Rust-generated WebAssembly that interoperates with JavaScript.

cargo install [email protected]

For more information, see the wasm-pack documentation.

Building

To build the library:

nx build c2pa-wasm

This will execute the commands defined in the nx-wasm-bindgen executor to produce the final output in the pkg/ directory.

Testing

The library relies on wasm-pack to run its tests. As a general principle, the majority of test coverage will come from c2pa-web's test suite.

To run the tests:

nx test c2pa-wasm

版本与发布记录

@contentauth/c2pa-wasm 共发布 41 个版本,首次发布于 2025/08/30;过去 12 个月发布了 34 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.14.0latest2026/11/055 天前
0.13.52026/11/046 天前
0.13.42026/10/2714 天前
0.13.32026/10/1724 天前
0.13.22026/09/301 个月前
0.13.12026/09/241 个月前

关于 @contentauth/c2pa-wasm 的常见问题

@contentauth/c2pa-wasm 是什么?

The WebAssembly wrapper for c2pa-rs that powers c2pa-web, built with wasm-bindgen. While these bindings can be used directly, most users will prefer the convenie

如何安装 @contentauth/c2pa-wasm?

在项目目录运行 npm install @contentauth/c2pa-wasm,或使用 pnpm add / yarn add / bun add。

@contentauth/c2pa-wasm 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@contentauth/c2pa-wasm 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@contentauth/c2pa-wasm 可以商用吗?

@contentauth/c2pa-wasm 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@contentauth/c2pa-wasm 的下载量有多少?

根据 npm 官方下载统计,@contentauth/c2pa-wasm 在 2026/10/11 – 2026/11/09 这 30 天内被下载 332,929 次,日均约 11,098 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@contentauth/c2pa-wasm 还在维护吗?

最新版本 0.14.0 发布于 2026/11/05(5 天前);至今共发布 41 个版本,其中过去 12 个月发布了 34 个;首次发布于 2025/08/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。