0.2.0 • Published 5 years ago
dvi2html-wasm v0.2.0
A dvi2html converter written in Rust and ported to WebAssembly using wasm-pack.
About
- NPM package to convert dvi files (as Uint8Array) to html
- It uses the dvi2html rust package (see crate folder)
- Install with
npm i dvi2html-wasm
oryarn add dvi2html-wasm
Example
import {dvi2html} from "dvi2html-wasm";
fetch('http://localhost:8080/main.dvi')
.then(res => res.blob())
.then(b => b.arrayBuffer())
.then(b => {
console.log(b);
console.time("Generating html");
let result = dvi2html(new Uint8Array(b))
console.timeEnd("Generating html");
console.time("Adding to body");
let child = document.createElement('div');
child.innerHTML= result;
document.body.appendChild(child);
console.timeEnd("Adding to body");
});
Development
Commands
Build with wasm-pack build
wasm-pack build
Test in Headless Browsers with wasm-pack test
wasm-pack test --headless --firefox
Publish to NPM with wasm-pack publish
wasm-pack publish
Info
wasm-bindgen
for communicating between WebAssembly and JavaScript.console_error_panic_hook
for logging panic messages to the developer console.wee_alloc
, an allocator optimized for small code size.- tutorials
- template-docs