Skip to content

Compressing a WASM+JS file into a single executable polyglot PNG+HTML file

License

Notifications You must be signed in to change notification settings

datatrash/wasm-png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WASM-PNG

Combines a Javascript and WASM file into a single executable polygot PNG+HTML file.

Usage:

  • cargo install wasmpng
  • wasmpng --wasm-file my.wasm --js-file my.js
  • This will generate index.png.html which will automatically unpack and execute, loading itself as a PNG and extracting the data from there

NOTE: By default file access is blocked in Chrome, so you can't test this locally unless you spin up an HTTP server. Start Chrome with the --allow-file-access-from-file to remove this restriction.

The Javascript will receive the WASM as a regular array in arguments[0]. See the examples folder for an example.

You can also pass --max-width to restrict the width of the generated PNG.

Inspiration and parts of the loader code come from pnginator by Gasman et al.

About

Compressing a WASM+JS file into a single executable polyglot PNG+HTML file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published