Socket
Socket
Sign inDemoInstall

@hfour/imager-wasm

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hfour/imager-wasm

selected image-rs function into wasm for nodejs


Version published
Weekly downloads
0
decreased by-100%
Maintainers
7
Weekly downloads
 
Created
Source

imager-wasm

Build Status

This a simple package to compile selected functions from the image-rs rust package to wasm, and make them available to nodejs. It's configured to support at least GIF, PNG and JPEG (but this may vary depending on our needs).

We don't wrap the whole of image-rs because the .wasm file will be too big, and then there's no nodejs build system that could only take parts of that .wasm file. The rust linker though will only include the used functions in the .wasm file.

Setup

rustup target add wasm32-unknown-unknown
cargo install wasm-pack
~/.cargo/bin/wasm-pack build --release -t nodejs

Example usage from node (sync code):

fs = require('fs');
img1 = fs.readFileSync('problem.jpg');

m = require('./pkg/imager_wasm');
img2 = m.thumbnail(img1, 800, 800);

fs.writeFileSync('solution.jpg', img2);

References

Making a release on npmjs

This repo has travis configured to publish the build node package on npmjs. When a commit on the master branch is tagged, travis will try to push the package to npmjs. The version of the node package is copied from Cargo.toml, so it's up to you make sure the version is updated accordingly. The tag name is not used, but should follow the version in Cargo.toml (and so the node package version). For example, the 0.1.0 version should be tagged as v0.1.0.

FAQs

Package last updated on 07 Oct 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc