@hpcc-js/wasm-base91
v1.17.0
Published
hpcc-js - WASM Base91
Maintainers
Readme
title: Base91 description: WebAssembly wrapper for the Base91 encoding library outline: deep
@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
::: code-group
npm install @hpcc-js/wasm-base91yarn add @hpcc-js/wasm-base91pnpm add @hpcc-js/wasm-base91:::
Quick Start
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
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():
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.
