Interface IClipboard

interface IClipboard {
    hasFiles: () => Promise<boolean>;
    hasHTML: () => Promise<boolean>;
    hasImage: () => Promise<boolean>;
    hasRTF: () => Promise<boolean>;
    hasText: () => Promise<boolean>;
    readFiles: () => Promise<string[]>;
    readHtml: () => Promise<string>;
    readImageBase64: () => Promise<string>;
    readImageBinary: (
        format: "Uint8Array" | "int_array" | "Blob",
    ) => Promise<number[] | Uint8Array | Blob>;
    readRtf: () => Promise<string>;
    readText: () => Promise<string>;
    writeFiles: (filesPaths: string[]) => Promise<void>;
    writeHtml: (html: string) => Promise<void>;
    writeHtmlAndText: (html: string, text: string) => Promise<void>;
    writeImageBase64: (base64: string) => Promise<void>;
    writeImageBinary: (bytes: number[]) => Promise<void>;
    writeRtf: (rtf: string) => Promise<void>;
    writeText: (text: string) => Promise<void>;
}

Properties

hasFiles: () => Promise<boolean>
hasHTML: () => Promise<boolean>
hasImage: () => Promise<boolean>
hasRTF: () => Promise<boolean>
hasText: () => Promise<boolean>
readFiles: () => Promise<string[]>
readHtml: () => Promise<string>
readImageBase64: () => Promise<string>

Type declaration

    • (): Promise<string>
    • read clipboard image

      Returns Promise<string>

      image in base64 string

readImageBinary: (
    format: "Uint8Array" | "int_array" | "Blob",
) => Promise<number[] | Uint8Array | Blob>

Type declaration

    • (
          format: "Uint8Array" | "int_array" | "Blob",
      ): Promise<number[] | Uint8Array | Blob>
    • Read clipboard image, get the data in binary format int_array (Array) is received from Tauri core, Uint8Array and Blob are transformed from int_array

      Parameters

      • format: "Uint8Array" | "int_array" | "Blob"

        data type of returned value, "int_array" is the fastest

      Returns Promise<number[] | Uint8Array | Blob>

readRtf: () => Promise<string>
readText: () => Promise<string>
writeFiles: (filesPaths: string[]) => Promise<void>
writeHtml: (html: string) => Promise<void>
writeHtmlAndText: (html: string, text: string) => Promise<void>

Type declaration

    • (html: string, text: string): Promise<void>
    • Write html and text to clipboard. writeHtml API only writes html, readText will return nothing. This API writes both html and text, so readText will return the text.

      Parameters

      • html: string
      • text: string

      Returns Promise<void>

writeImageBase64: (base64: string) => Promise<void>

Type declaration

    • (base64: string): Promise<void>
    • write image to clipboard

      Parameters

      • base64: string

      Returns Promise<void>

      Promise

writeImageBinary: (bytes: number[]) => Promise<void>
writeRtf: (rtf: string) => Promise<void>
writeText: (text: string) => Promise<void>