Skip to content

WebAssembly SDK (WASM)

Terminal window
npm install @sv-stark/ebook-rs
import init, { WasmBook } from '@sv-stark/ebook-rs';
async function run() {
await init();
const res = await fetch('/books/alice.epub');
const buffer = new Uint8Array(await res.arrayBuffer());
const book = WasmBook.from_bytes(buffer);
console.log('Book Title:', book.title);
const sectionHtml = book.get_section_html(0);
document.getElementById('content').innerHTML = sectionHtml;
}
run();
```\n