npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ohos-ports-electron/napi-rs-canvas

v1.0.2-electron-oh.5

Published

Canvas for Node.js with skia backend (OpenHarmony native build)

Readme

@ohos-ports-electron/napi-rs-canvas

OpenHarmony arm64 port of napi-rs Canvas 1.0.2, with separate source-built native addons for standalone Node and Electron-OH. Package JavaScript and types start from the locked @ohos-ports/[email protected] baseline; the Node native addon is rebuilt to fix the same Lottie recording defect as Electron.

npm install @ohos-ports-electron/napi-rs-canvas
const { createCanvas } = require('@ohos-ports-electron/napi-rs-canvas')
const canvas = createCanvas(100, 100)
canvas.getContext('2d').fillRect(0, 0, 100, 100)
const png = canvas.toBuffer('image/png')

This package targets OpenHarmony arm64. It does not add desktop Linux, macOS, or Windows binaries. Preserve the original upstream API and types. See upstream Canvas for API documentation.

Electron-OH application integration

Use the framework belonging to the selected Electron-OH release. This package does not contain Electron, a HAP, or an SDK.

Copy native/electron/skia.electron-oh-arm64.node to the application's code-signed native library directory, retaining this basename. The loader checks /data/storage/el1/bundle/libs/arm64/ and arm64-v8a/, then the packaged relative native directory. Apply native code signing, HAP signing and verification. A resource-only copy can be rejected by the framework's loader namespace.

Older Electron 25 Workers can omit process.versions.electron. Before requiring the package in such a Worker, set the existing NAPI_RS_NATIVE_LIBRARY_PATH override to the actual signed Electron addon path used by the main process. Do not overwrite skia.openharmony-arm64.node, which is the standalone Node binary.

The tested 37.2.0 and 40.0.0 framework inputs require project-local repair of their internal N-API relocations. The contribution recipe includes hash-guarded bind-electron37-napi.py and bind-electron40-napi.py; apply only to the specified input hashes, before rebuilding and signing your HAP. Installing this npm package does not modify a shared framework. Record and deploy the effective engine hash as part of the application.

Native Canvas runs in --jitless mode in this acceptance setup. Electron 25 requires the flag in the ArkTS/native startup arguments before runBrowser, because application JavaScript can run too late. This package does not establish JIT/WASM compatibility or replace permissions required by an application's other components.

Native provenance and licenses

The Electron addon is built from upstream Canvas commit 826600b258db693d98a652c935e2b94107b41bb2, matching Skia commit 634e970210b7f8233cec53510bf82a3c9c18a80d, locked Cargo/Skia dependencies, and the source patches in the contribution recipe. It statically contains a project-maintained, typed C forwarding shim. It does not link the unavailable source of the historical official libshim.a, and needs no old bridge .so.

native-source.json records the source, patch, compiler and output hashes. licenses/ contains collected dependency notices, including source/build dependencies; the collection is a superset and does not assert every listed component is linked into the addon. LICENSE retains the upstream Canvas license. The Node addon uses the same patched Canvas/Skia sources and resolves Node-API symbols from its Node host; it does not link the Electron forwarding shim.

The source and integration recipe is maintained in ports/napi-rs-canvas/1.0.2. Acceptance reports bind exact package and framework hashes. Support claims are limited to recorded device runs and their declared test scope; they do not imply exhaustive API or resource-pressure testing.