UNPKG

taglib-wasm

Version:

TagLib for TypeScript platforms: Deno, Node.js, Bun, Electron, browsers, and Cloudflare Workers

70 lines 2.62 kB
/** * @fileoverview MessagePack encoder for taglib-wasm * * Converts JavaScript objects to binary MessagePack data for the C API. * Provides 10x faster serialization compared to JSON and 50% smaller * payloads for optimal performance. * * Uses @msgpack/msgpack for reliable cross-platform encoding. */ import { type EncoderOptions } from "@msgpack/msgpack"; import type { AudioProperties, ExtendedTag, Picture, PropertyMap } from "../types.ts"; /** * Encode tag data to MessagePack binary format */ export declare function encodeTagData(tagData: ExtendedTag): Uint8Array; /** * Encode audio properties to MessagePack binary format */ export declare function encodeAudioProperties(audioProps: AudioProperties): Uint8Array; /** * Encode property map to MessagePack binary format */ export declare function encodePropertyMap(propertyMap: PropertyMap): Uint8Array; /** * Encode picture data to MessagePack binary format */ export declare function encodePicture(picture: Picture): Uint8Array; /** * Encode array of pictures to MessagePack binary format */ export declare function encodePictureArray(pictures: Picture[]): Uint8Array; /** * Generic MessagePack encoder with custom options */ export declare function encodeMessagePack<T>(data: T, options?: Partial<EncoderOptions>): Uint8Array; /** * Encode with size optimization for large datasets */ export declare function encodeMessagePackCompact<T>(data: T): Uint8Array; /** * Batch encode multiple tag records for efficient bulk processing */ export declare function encodeBatchTagData(tagDataArray: ExtendedTag[]): Uint8Array; /** * Encode with streaming support for very large datasets */ export declare function encodeMessagePackStream<T>(dataIterator: Iterable<T>): Generator<Uint8Array, void, unknown>; /** * Calculate the approximate size of data when encoded to MessagePack */ export declare function estimateMessagePackSize(data: unknown): number; /** * Performance-optimized encoder for basic tag fields only * Encodes only essential metadata fields for faster processing */ export declare function encodeFastTagData(tagData: Pick<ExtendedTag, "title" | "artist" | "album" | "year" | "track">): Uint8Array; /** * Validate that data can be safely encoded to MessagePack */ export declare function canEncodeToMessagePack(data: unknown): boolean; /** * Compare the efficiency of MessagePack vs JSON encoding */ export declare function compareEncodingEfficiency(data: unknown): { messagePackSize: number; jsonSize: number; sizeReduction: number; speedImprovement: number; }; //# sourceMappingURL=encoder.d.ts.map