taglib-wasm
Version:
TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps
45 lines • 1.76 kB
TypeScript
/**
* @fileoverview Module loading functions for TagLib Wasm initialization
*
* Handles both WASI (optimal for Deno/Node.js) and Emscripten (browser fallback)
* module loading strategies.
*/
import type { LoadTagLibOptions } from "./loader-types.js";
import type { TagLibModule } from "../wasm.js";
/**
* Load the TagLib Wasm module.
* This function initializes the WebAssembly module and returns
* the loaded module for use with the Full API.
*
* Automatically selects the optimal implementation:
* - WASI for Deno/Node.js (faster filesystem access, MessagePack serialization)
* - Emscripten for browsers (universal compatibility)
*
* @param options - Optional configuration for module initialization
* @returns Promise resolving to the initialized TagLib module
*
* @example
* ```typescript
* import { loadTagLibModule, TagLib } from "taglib-wasm";
*
* // Auto-select optimal implementation
* const module = await loadTagLibModule();
* const taglib = new TagLib(module);
*
* // Force Emscripten mode (in-memory I/O)
* const module = await loadTagLibModule({ forceWasmType: "emscripten" });
*
* // Force WASI mode (Deno/Node.js only)
* const module = await loadTagLibModule({ forceWasmType: "wasi" });
*
* // With custom WASM binary (selects the Emscripten backend; the bytes
* // must be its artifact, taglib-web.wasm)
* const wasmData = await fetch("taglib-web.wasm").then(r => r.arrayBuffer());
* const module = await loadTagLibModule({ wasmBinary: wasmData });
* ```
*
* @note Most users should use `TagLib.initialize()` instead,
* which handles module loading automatically.
*/
export declare function loadTagLibModule(options?: LoadTagLibOptions): Promise<TagLibModule>;
//# sourceMappingURL=module-loader.d.ts.map