Appearance
@hpcc-js/wasm-base91
This package provides a WebAssembly wrapper around the Base91 library. This allows for the encoding and decoding of binary data to a more compact form than Base64.
Installation
sh
npm install @hpcc-js/wasm-base91sh
yarn add @hpcc-js/wasm-base91sh
pnpm add @hpcc-js/wasm-base91Quick Start
typescript
import { Base91 } from "@hpcc-js/wasm-base91";
const base91 = await Base91.load();
const encoded_data = await base91.encode(data);
const decoded_data = await base91.decode(encoded_data);Try it
Loading Base91...
Resource management
Base91 supports dispose() and TypeScript's using declarations (TypeScript 5.2+ with "ESNext.Disposable" in lib). Leaving the scope is equivalent to calling Base91.unload():
typescript
import { Base91 } from "@hpcc-js/wasm-base91";
{
using base91 = await Base91.load();
const encoded_data = base91.encode(data);
const decoded_data = base91.decode(encoded_data);
} // Base91.unload() runs hereBase91.load() returns a singleton, so disposing it unloads the module for every caller in the current JavaScript context. Disposing an instance that has already been unloaded does nothing.