taglib-wasm
Version:
TagLib for TypeScript platforms: Deno, Node.js, Bun, Electron, browsers, and Cloudflare Workers
55 lines • 1.98 kB
TypeScript
/**
* @fileoverview Helper utilities for using taglib-wasm in Deno compiled binaries
*
* This module provides simplified initialization for offline usage in compiled
* Deno binaries, with automatic detection and embedded WASM loading.
*
* @module taglib-wasm/deno-compile
*/
import { TagLib } from "./taglib.ts";
/**
* Detects if the code is running in a compiled Deno binary.
*
* @returns true if running in a Deno compiled binary, false otherwise
*/
export declare function isDenoCompiled(): boolean;
/**
* Initialize TagLib with automatic handling for Deno compiled binaries.
*
* In compiled binaries, this function attempts to load embedded WASM from a
* specified path relative to the binary. If the embedded WASM is not found
* or if running in development mode, it falls back to network fetch.
*
* @param embeddedWasmPath - Path to embedded WASM file (default: './taglib.wasm')
* @returns Promise resolving to initialized TagLib instance
*
* @example
* ```typescript
* // Basic usage with default path
* const taglib = await initializeForDenoCompile();
*
* // Custom embedded WASM path
* const taglib = await initializeForDenoCompile('./assets/taglib.wasm');
*
* // Compile command:
* // deno compile --allow-read --include taglib.wasm myapp.ts
* ```
*/
export declare function initializeForDenoCompile(embeddedWasmPath?: string): Promise<TagLib>;
/**
* Helper function to prepare a WASM file for embedding in a compiled binary.
* This function copies the WASM file from node_modules to a local path.
*
* @param outputPath - Where to save the WASM file (default: './taglib.wasm')
*
* @example
* ```typescript
* // In your build script:
* await prepareWasmForEmbedding('./assets/taglib.wasm');
*
* // Then compile with:
* // deno compile --allow-read --include assets/taglib.wasm myapp.ts
* ```
*/
export declare function prepareWasmForEmbedding(outputPath?: string): Promise<void>;
//# sourceMappingURL=deno-compile.d.ts.map