/** @packageDocumentation WavPack file format handler. Supports APE (primary) and ID3v1 (secondary) tags. */ import { File } from "../file.js"; import { Tag } from "../tag.js"; import { ReadStyle } from "../toolkit/types.js"; import type { IOStream } from "../toolkit/ioStream.js"; import { ID3v1Tag } from "../mpeg/id3v1/id3v1Tag.js"; import { ApeTag } from "../ape/apeTag.js"; import { WavPackProperties } from "./wavpackProperties.js"; /** Bitmask of tag types present in or to be applied to a WavPack file. */ export declare enum WavPackTagTypes { /** No tags. */ NoTags = 0, /** ID3v1 tag appended at the end of the file. */ ID3v1 = 1, /** APE tag written immediately before the ID3v1 tag (or at EOF). */ APE = 4, /** All supported tag types. */ AllTags = 65535 } /** * WavPack file format handler. * * Supports APE (primary) and ID3v1 (secondary) tags. */ export declare class WavPackFile extends File { /** The APE tag read from or to be written to the file, or `null` if absent. */ private _apeTag; /** The ID3v1 tag read from or to be written to the file, or `null` if absent. */ private _id3v1Tag; /** Priority-ordered combined view of all tags (APE preferred over ID3v1). */ private _combinedTag; /** Parsed audio properties, or `null` if not yet read. */ private _properties; /** Byte offset of the APE tag in the file, or `-1` if absent. */ private _apeLocation; /** Original byte size of the APE tag on disk (used for in-place replacement). */ private _apeOriginalSize; /** Byte offset of the ID3v1 tag in the file, or `-1` if absent. */ private _id3v1Location; /** * Private constructor — use {@link WavPackFile.open} to create instances. * @param stream - The underlying I/O stream for the WavPack file. */ private constructor(); /** * Open and parse a WavPack file from the given stream. * @param stream - The I/O stream to read from. * @param readProperties - Whether to parse audio properties. Defaults to `true`. * @param readStyle - Level of detail for audio property parsing. Defaults to `ReadStyle.Average`. * @returns A fully initialised `WavPackFile` instance. */ static open(stream: IOStream, readProperties?: boolean, readStyle?: ReadStyle): Promise; /** * Quick-check whether `stream` looks like a valid WavPack file. * A WavPack file begins with the `"wvpk"` magic bytes. * @param stream - The I/O stream to inspect. * @returns `true` if the stream starts with the WavPack magic. */ static isSupported(stream: IOStream): Promise; /** * Returns the combined tag providing unified access to all tag data. * @returns The {@link CombinedTag} for this file (APE preferred over ID3v1). */ tag(): Tag; /** * Returns the audio properties parsed from the WavPack block headers. * @returns The {@link WavPackProperties}, or `null` if `readProperties` was `false` on open. */ audioProperties(): WavPackProperties | null; /** * Writes all pending tag changes to the file. * @returns `true` on success, `false` if the file is read-only. */ save(): Promise; /** * Get the ID3v1 tag, optionally creating one if absent. * @param create - When `true`, a new empty tag is created if none exists. * @returns The {@link ID3v1Tag}, or `null` if absent and `create` is `false`. */ id3v1Tag(create?: boolean): ID3v1Tag | null; /** * Get the APE tag, optionally creating one if absent. * @param create - When `true`, a new empty tag is created if none exists. * @returns The {@link ApeTag}, or `null` if absent and `create` is `false`. */ apeTag(create?: boolean): ApeTag | null; /** * Remove the specified tag types from the in-memory representation. * Call `save()` afterwards to persist the changes to disk. * @param tags - Bitmask of tag types to remove. Defaults to {@link WavPackTagTypes.AllTags}. */ strip(tags?: WavPackTagTypes): void; /** Whether the file on disk has an ID3v1 tag. */ get hasID3v1Tag(): boolean; /** Whether the file on disk has an APE tag. */ get hasAPETag(): boolean; /** * Reads all tags and (optionally) audio properties from the file. * @param readProperties - Whether to parse audio properties. * @param readStyle - Level of detail for audio property parsing. */ private read; /** * Searches the end of the file for an ID3v1 tag and, if found, * populates {@link _id3v1Location} and {@link _id3v1Tag}. */ private findID3v1; /** * Searches for an APE tag footer immediately before the ID3v1 tag (or end of file) * and, if found, populates {@link _apeLocation}, {@link _apeOriginalSize}, and {@link _apeTag}. */ private findAPE; /** * Rebuilds {@link _combinedTag} from the currently active tag objects, * ordered by priority (APE before ID3v1). */ private refreshCombinedTag; } //# sourceMappingURL=wavpackFile.d.ts.map