Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
esm-potrace-wasm
Advanced tools
A modern ESM build of the Potrace library for use in the browser.
A modern ESM build of the Potrace library for use in the browser.
npm install --save esm-potrace-wasm
import { potrace, init } from 'esm-potrace-wasm';
(async () => {
// Initialize the module once.
await init();
/**
* The `imageBitmapSource` parameter is an `ImageBitmapSource`, that is any of:
* - `HTMLImageElement`
* - `SVGImageElement`
* - `HTMLVideoElement`
* - `HTMLCanvasElement`
* - `ImageData`
* - `ImageBitmap`
* - `Blob`
*/
const svg = await potrace(
imageBitmapSource,
(options = {
turdsize: 2,
turnpolicy: 4,
alphamax: 1,
opticurve: 1,
opttolerance: 0.2,
pathonly: false,
extractcolors: true,
posterizelevel: 2, // [1, 255]
posterizationalgorithm: 0, // 0: simple, 1: interpolation
})
);
})();
Modify src/potrace/
and run npm run build
to update the ESM build in dist/
.
The emscripten build file is located at ./build.sh
(or build.ps1
for Win32) respectively. A simple demo
that imports dist/index.js
is available in demo/
and can be started by running npm start
.
This library is used in SVGcode.
⚠️ GPL-v2.0, due to the original Potrace license.
Based on @nturley's fork of @IguteChung's initial potrace-wasm. Unfortunately, the original author did not react on my Pull Request, so I forked.
FAQs
A modern ESM build of the Potrace library for use in the browser.
The npm package esm-potrace-wasm receives a total of 1,520 weekly downloads. As such, esm-potrace-wasm popularity was classified as popular.
We found that esm-potrace-wasm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.