taglib-wasm
Version:
TagLib for TypeScript platforms: Deno, Node.js, Bun, Electron, browsers, and Cloudflare Workers
57 lines • 2.38 kB
TypeScript
/**
* @fileoverview MessagePack decoder for taglib-wasm
*
* Converts binary MessagePack data from the C API to JavaScript objects.
* Provides 10x faster deserialization compared to JSON parsing and
* supports zero-copy access for binary data like album art.
*
* Uses @msgpack/msgpack for reliable cross-platform decoding.
*/
import { type DecoderOptions } from "@msgpack/msgpack";
import type { AudioProperties, ExtendedTag, Picture, PropertyMap } from "../types.ts";
/**
* Decode MessagePack binary data to a typed tag record
*/
export declare function decodeTagData(msgpackBuffer: Uint8Array): ExtendedTag;
/**
* Decode MessagePack binary data to audio properties
*/
export declare function decodeAudioProperties(msgpackBuffer: Uint8Array): AudioProperties;
/**
* Decode MessagePack binary data to a property map (key-value pairs)
*/
export declare function decodePropertyMap(msgpackBuffer: Uint8Array): PropertyMap;
/**
* Decode MessagePack binary data to picture/album art
*/
export declare function decodePicture(msgpackBuffer: Uint8Array): Picture;
/**
* Decode MessagePack binary data to an array of pictures
*/
export declare function decodePictureArray(msgpackBuffer: Uint8Array): Picture[];
/**
* Generic MessagePack decoder with type assertion
*/
export declare function decodeMessagePack<T = unknown>(msgpackBuffer: Uint8Array, options?: Partial<DecoderOptions>): T;
/**
* Decode MessagePack with automatic type detection based on structure
*/
export declare function decodeMessagePackAuto(msgpackBuffer: Uint8Array): ExtendedTag | AudioProperties | Picture | PropertyMap | unknown;
/**
* Validate that a buffer contains valid MessagePack data
*/
export declare function isValidMessagePack(buffer: Uint8Array): boolean;
/**
* Get information about MessagePack data without fully decoding
*/
export declare function getMessagePackInfo(buffer: Uint8Array): {
isValid: boolean;
approximateSize: number;
type: "array" | "map" | "string" | "binary" | "number" | "boolean" | "null" | "extension" | "unknown";
};
/**
* Performance-optimized decoder for frequently accessed tag fields
* Only decodes essential metadata fields to reduce processing time
*/
export declare function decodeFastTagData(msgpackBuffer: Uint8Array): Pick<ExtendedTag, "title" | "artist" | "album" | "year" | "track">;
//# sourceMappingURL=decoder.d.ts.map