Class File

Uploaded File

Hierarchy

  • File

Constructors

  • Construct File

    Parameters

    • client: Client

      Client

    • file: Pick<{
          _id: string;
          content_type: string;
          deleted?: null | boolean;
          filename: string;
          message_id?: null | string;
          metadata: {
              type: "File";
          } | {
              type: "Text";
          } | {
              height: number;
              type: "Image";
              width: number;
          } | {
              height: number;
              type: "Video";
              width: number;
          } | {
              type: "Audio";
          };
          object_id?: null | string;
          reported?: null | boolean;
          server_id?: null | string;
          size: number;
          tag: string;
          user_id?: null | string;
      }, "_id" | "tag" | "metadata"> & Partial<{
          _id: string;
          content_type: string;
          deleted?: null | boolean;
          filename: string;
          message_id?: null | string;
          metadata: {
              type: "File";
          } | {
              type: "Text";
          } | {
              height: number;
              type: "Image";
              width: number;
          } | {
              height: number;
              type: "Video";
              width: number;
          } | {
              type: "Audio";
          };
          object_id?: null | string;
          reported?: null | boolean;
          server_id?: null | string;
          size: number;
          tag: string;
          user_id?: null | string;
      }>

      File

    Returns File

Properties

#client: Client
contentType?: string

Raw content type of this file

filename?: string

Original filename

id: string

File Id

metadata: {
    type: "File";
} | {
    type: "Text";
} | {
    height: number;
    type: "Image";
    width: number;
} | {
    height: number;
    type: "Video";
    width: number;
} | {
    type: "Audio";
}

Parsed metadata of the file

Type declaration

  • type: "File"

Type declaration

  • type: "Text"

Type declaration

  • height: number

    Format: uint

  • type: "Image"
  • width: number

    Format: uint

Type declaration

  • height: number

    Format: uint

  • type: "Video"
  • width: number

    Format: uint

Type declaration

  • type: "Audio"
size?: number

Size of the file (in bytes)

tag: string

File bucket

Accessors

  • get isSpoiler(): boolean
  • Whether this file should have a spoiler

    Returns boolean

Methods

  • Creates a URL to a given file with given options.

    Parameters

    • Optional options: {
          height?: number;
          max_side?: number;
          size?: number;
          width?: number;
      }

      Optional query parameters to modify object

      • Optional height?: number
      • Optional max_side?: number
      • Optional size?: number
      • Optional width?: number
    • Optional allowAnimation: boolean

      Returns GIF if applicable, no operations occur on image

    Returns undefined | string

    Generated URL or nothing

Generated using TypeDoc