telegramsjs
    Preparing search index...

    Class InputFile

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    id: string

    The unique identifier for this file

    path: string | null

    The path to the file on the Telegram server, if available

    size: number | null

    The size of the file in bytes, if available

    uniqueId: string

    The unique identifier for this file, which is supposed to be consistent across different bots

    Accessors

    • get url(): string | null

      Gets the URL to access the file on the Telegram server.

      Returns string | null

    Methods

    • Protected

      Creates a clone of the current instance

      Returns Base

      A clone of the current instance

    • Protected

      Patches the current instance with new data

      Parameters

      • data: Record<string, any>

        The data to patch the instance with

      Returns Record<string, any>

      The patched data

    • Protected

      Updates the current instance with new data and returns a clone of the updated instance

      Parameters

      • data: Record<string, any>

        The data to update the instance with

      Returns Base

      A clone of the updated instance

    • Downloads the file from the Telegram server.

      Returns Promise<Buffer<ArrayBufferLike>>

      A promise that resolves with the file data as a Buffer.

    • Flatten an object. Any properties that are collections will get converted to an array of keys.

      Parameters

      • OptionalpropsRecursive: boolean

        Optional. If true, calls toJSON method on nested objects.

      • ...props: Record<string, string | boolean>[]

        Optional. Specific properties to include/exclude, or rename.

      Returns Record<string, any>

      Flattened object.

    • Returns the id instance Chat, User, ChatMember and other

      Returns string | null

    • Writes the file to the specified path.

      Parameters

      • path: string

        The path where the file should be written.

      • OptionalwriteType: "promise"

        The type of write operation.

      • Optionaloptions: { encoding?: BufferEncoding; flag?: string; signal?: AbortSignal }

        Additional options for writing the file.

      Returns Promise<void>

      A promise that resolves when the file has been written.

    • Writes the file to the specified path.

      Parameters

      • path: string

        The path where the file should be written.

      • writeType: "stream"

        The type of write operation.

      • Optionaloptions: {
            autoClose?: boolean;
            emitClose?: boolean;
            encoding?: BufferEncoding;
            flush?: boolean;
            highWaterMark?: number;
            start?: number;
        }

        Additional options for writing the file.

      Returns Promise<void>

      A promise that resolves when the file has been written.

    • Writes the file to the specified path.

      Parameters

      • path: string

        The path where the file should be written.

      • OptionalwriteType: "stream" | "promise"

        The type of write operation.

      • Optionaloptions: undefined

        Additional options for writing the file.

      Returns Promise<void>

      A promise that resolves when the file has been written.