Class: Id3v2AttachmentFrame

November 25, 2024 · View on GitHub

node-taglib-sharp / Exports / Id3v2AttachmentFrame

Class: Id3v2AttachmentFrame

Interface that provides generic information about a picture, including its contents, as used by various formats.

Hierarchy

Implements

Table of contents

Accessors

Methods

Accessors

data

get data(): ByteVector

Gets the image data stored in the current instance.

Returns

ByteVector

Implementation of

IPicture.data

set data(value): void

Sets the image data stored in the current instance.

Parameters

NameType
valueByteVector

Returns

void

Implementation of

IPicture.data


description

get description(): string

Gets the description stored in the current instance.

Returns

string

Implementation of

IPicture.description

set description(value): void

Sets the description stored in the current instance. There should only be one frame with a matching description and type per tag.

Parameters

NameType
valuestring

Returns

void

Implementation of

IPicture.description


encryptionId

get encryptionId(): number

Gets the encryption ID applied to the current instance.

Returns

number

Value containing the encryption identifier for the current instance or undefined if not set.

Inherited from

Frame.encryptionId

set encryptionId(value): void

Sets the encryption ID applied to the current instance.

Parameters

NameTypeDescription
valuenumberValue containing the encryption identifier for the current instance. Must be an 8-bit unsigned integer. Setting to undefined will remove the encryption header and ID

Returns

void

Inherited from

Frame.encryptionId


filename

get filename(): string

Gets a filename of the picture stored in the current instance.

Returns

string

Implementation of

IPicture.filename

set filename(value): void

Sets a filename of the picture stored in the current instance.

Parameters

NameType
valuestring

Returns

void

Implementation of

IPicture.filename


flags

get flags(): Id3v2FrameFlags

Gets the frame flags applied to the current instance.

Returns

Id3v2FrameFlags

Inherited from

Frame.flags

set flags(value): void

Sets the frame flags applied to the current instance. If the value includes either Encryption or Compression, render will throw.

Parameters

NameType
valueId3v2FrameFlags

Returns

void

Inherited from

Frame.flags


frameClassType

get frameClassType(): Id3v2FrameClassType

Gets a flag indicating which type of frame the current instance is.

Returns

Id3v2FrameClassType

Overrides

Frame.frameClassType


frameId

get frameId(): Id3v2FrameIdentifier

Gets the frame ID for the current instance.

Returns

Id3v2FrameIdentifier

Object representing of the identifier of the frame

Inherited from

Frame.frameId


groupId

get groupId(): number

Gets the grouping ID applied to the current instance.

Returns

number

Value containing the grouping identifier for the current instance, or undefined if not set.

Inherited from

Frame.groupId

set groupId(value): void

Sets the grouping ID applied to the current instance.

Parameters

NameTypeDescription
valuenumberGrouping identifier for the current instance. Must be an 8-bit unsigned integer. Setting to undefined will remove the grouping identity header and ID

Returns

void

Inherited from

Frame.groupId


Protected get header(): Id3v2FrameHeader

Gets the header for the frame. For new frames this should not exist.

Returns

Id3v2FrameHeader

Inherited from

Frame.header

Protected set header(value): void

Sets the header for the frame.

Parameters

NameTypeDescription
valueId3v2FrameHeaderHeader for the frame

Returns

void

Inherited from

Frame.header


mimeType

get mimeType(): string

Gets the MimeType of the picture stored in the current instance.

Returns

string

Implementation of

IPicture.mimeType

set mimeType(value): void

Sets the MimeType of the picture stored in the current instance.

Parameters

NameTypeDescription
valuestringMimeType of the picture stored in the current instance.

Returns

void

Implementation of

IPicture.mimeType


size

get size(): number

Gets the size of the current instance as it was last stored on disk. NOTE: This value is not used outside of reading a frame from disk, so newly created frames should not have this value set.

Returns

number

Inherited from

Frame.size


textEncoding

get textEncoding(): StringType

Gets the text encoding to use when storing the current instance.

Value

Text encoding to use when storing the current instance.

Returns

StringType

set textEncoding(value): void

Sets the text encoding to use when storing the current instance.

Parameters

NameTypeDescription
valueStringTypeText encoding to use when storing the current instance. This encoding is overridden when rendering if forceDefaultEncoding is true or the render version does not support it.

Returns

void


type

get type(): PictureType

Gets the object type stored in the current instance.

Returns

PictureType

Implementation of

IPicture.type

set type(value): void

Sets the object type stored in the current instance. For General Object Frame, use NotAPicture. Other types will make it a Picture Frame.

Parameters

NameType
valuePictureType

Returns

void

Implementation of

IPicture.type

Methods

clone

clone(): Id3v2Frame

Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using the frame factory to create a new frame. As such, this method should be overridden by child classes.

Returns

Id3v2Frame

Overrides

Id3v2Frame.clone


fieldData

Protected fieldData(frameData, offset, version, dataIncludesHeader): ByteVector

Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as grouping ID.

Parameters

NameTypeDescription
frameDataByteVectorRaw frame data
offsetnumberIndex at which the data is contained
versionnumberVersion of the ID3v2 tag the data was originally encoded with
dataIncludesHeaderbooleantrue if frameData includes the header, false otherwise

Returns

ByteVector

Inherited from

Id3v2Frame.fieldData


parseFields

Protected parseFields(data, version): void

Populates the values in this frame by parsing its field data in a specified version.

Parameters

NameTypeDescription
dataByteVectorExtracted field data
versionnumberID3v2 version the field data is encoded in

Returns

void

Overrides

Id3v2Frame.parseFields


render

render(version): ByteVector

Renders the current instance, encoded in a specified ID3v2 version.

Parameters

NameTypeDescription
versionnumberVersion of ID3v2 to use when encoding the current instance

Returns

ByteVector

Inherited from

Id3v2Frame.render


renderFields

Protected renderFields(version): ByteVector

Renders the values in the current instance into field data for a specified version.

Parameters

NameTypeDescription
versionnumberID3v2 version the field data is to be encoded in.

Returns

ByteVector

Overrides

Id3v2Frame.renderFields


setData

Protected setData(data, offset, readHeader, version): void

Populates the current instance by reading the raw frame from disk, optionally reading the header.

Parameters

NameTypeDescription
dataByteVectorRaw ID3v2 frame
offsetnumberOffset in data at which the frame begins.
readHeaderbooleanWhether or not to read the reader into the current instance.
versionnumberVersion of the ID3v2 tag the data was encoded with

Returns

void

Inherited from

Id3v2Frame.setData


toString

toString(): string

Generates a string representation of the current instance.

Deprecated

No need for this.

Returns

string


correctEncoding

Static Protected correctEncoding(type, version): StringType

Converts an encoding to be a supported encoding for a specified tag version.

Parameters

NameTypeDescription
typeStringTypeValue containing the original encoding
versionnumberValue containing the ID3v2 version to be encoded.

Returns

StringType

Value containing the correct encoding to use, based on forceDefaultEncoding and what is supported by version

Inherited from

Id3v2Frame.correctEncoding


find

Static find(frames, description?, type?): Id3v2AttachmentFrame

Get a specified attachment frame from the specified tag, optionally creating it if it does not exist.

Parameters

NameTypeDefault valueDescription
framesId3v2AttachmentFrame[]undefinedList of attachment frames to search
description?stringundefinedDescription to match
typePictureTypePictureType.OtherPicture type to match

Returns

Id3v2AttachmentFrame

Matching frame or undefined if a match wasn't found and create is false


fromOffsetRawData

Static fromOffsetRawData(data, offset, header, version): Id3v2AttachmentFrame

Constructs and initializes a new attachment frame by reading its raw data in a specified ID3v2 version.

Parameters

NameTypeDescription
dataByteVectorByteVector containing the raw representation of the new frame
offsetnumberIndex into data where the frame actually begins
headerId3v2FrameHeaderHeader of the frame found at offset in the data
versionnumberID3v2 version the frame was originally encoded with

Returns

Id3v2AttachmentFrame


fromPicture

Static fromPicture(picture): Id3v2AttachmentFrame

Constructs and initializes a new attachment frame by populating it with the contents of another IPicture object.

Remarks

When a frame is created, it is not automatically added to the tag. Additionally, see pictures provides a generic way of getting and setting attachments which is preferable to format specific code.

Parameters

NameTypeDescription
pictureIPictureValue to use in the new instance.

Returns

Id3v2AttachmentFrame


fromRawData

Static fromRawData(data, version): Id3v2AttachmentFrame

Constructs and initializes a new attachment frame by reading its raw data in a specified Id3v2 version.

Parameters

NameTypeDescription
dataByteVectorByteVector starting with the raw representation of the new frame
versionnumberID3v2 version the raw frame is encoded with.

Returns

Id3v2AttachmentFrame