An audio file

Hierarchy (View Summary)

Constructors

Properties

TL object describing the audio

dcId?: number

DC ID of the file, when available

fileSize?: number

File size in bytes, when available

location:
    | Uint8Array
    | TypeInputFileLocation
    | TypeInputWebFileLocation
    | () => Uint8Array | TypeInputFileLocation | TypeInputWebFileLocation

Location of the file.

Either a TL object declaring remote file location, a Buffer containing actual file content (for stripped thumbnails and vector previews), or a function that will return either of those.

When a function is passed, it will be lazily resolved the first time downloading the file.

type: "audio" = ...

Type of the media (for use in a tagged union)

Accessors

  • get date(): Date
  • Date the document was sent

    Returns Date

  • get duration(): number
  • Duration of the audio in seconds.

    May not be accurate since provided by the sender.

    Returns number

  • get fileId(): string
  • Get TDLib and Bot API compatible File ID representing this document.

    Returns string

  • get fileName(): null | string
  • Original file name, extracted from the document attributes.

    Returns null | string

  • get inputDocument(): TypeInputDocument
  • Input document TL object generated from this object, to be used with methods that use it

    Returns TypeInputDocument

  • get mimeType(): string
  • File MIME type, as defined by the sender.

    Returns string

  • get performer(): null | string
  • Performer of the audio track.

    Returns null | string

  • get thumbnails(): readonly Thumbnail[]
  • Available thumbnails, if any.

    If there are no thumbnails, the array will be empty.

    Returns readonly Thumbnail[]

  • get title(): null | string
  • Title of the audio track.

    Returns null | string

  • get uniqueFileId(): string
  • Get a unique File ID representing this document.

    Returns string

Methods

  • Get a thumbnail by its type.

    Thumbnail types are described in the Telegram docs, and are also available as static members of Thumbnail for convenience.

    Parameters

    • type: string

      Thumbnail type

    Returns null | Thumbnail