UNPKG

taglib-wasm

Version:

TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps

44 lines (43 loc) 984 B
import { detectRuntime } from "../detector.js"; function selectWasmType(runtime, options) { if (options.forceWasmType) { return options.forceWasmType; } if (options.wasmBinary) { return "emscripten"; } if (options.disableOptimizations) { return "emscripten"; } if (runtime.wasmType === "wasi" && runtime.supportsFilesystem) { return "wasi"; } return "emscripten"; } function isWasiAvailable() { const runtime = detectRuntime(); return runtime.wasmType === "wasi" && runtime.supportsFilesystem; } function getRecommendedConfig() { const runtime = detectRuntime(); if (runtime.environment === "browser") { return { forceWasmType: "emscripten", disableOptimizations: false }; } if (runtime.supportsFilesystem) { return { forceWasmType: "wasi", disableOptimizations: false }; } return { disableOptimizations: false }; } export { getRecommendedConfig, isWasiAvailable, selectWasmType };