CMimeData
Container for data represented by MIME type.
import { CMimeData } from "canvas-toolkit-lib";Declared members
constructor(parent?: CObject | null);Creates an empty MIME data container. @param parent Parent object, or `null` for no parent.
formats(): string[];Returns all MIME types currently stored. @returns Array of MIME type strings.
hasFormat(mimeType: string): boolean;Checks whether data exists for a MIME type. @param mimeType MIME type to test. @returns `true` if the format is present.
data(mimeType: string): Uint8Array;Returns a copy of the data stored for a MIME type. @param mimeType MIME type to retrieve. @returns Stored bytes, or an empty array if the format is absent.
setData(mimeType: string, data: Uint8Array): void;Stores binary data for a MIME type. @param mimeType MIME type under which the data is stored. @param data Binary data to copy into the container.
removeFormat(mimeType: string): void;Removes data for a MIME type. @param mimeType MIME type to remove.
clear(): void;Removes all stored MIME data.
hasText(): boolean;Checks whether plain-text data is available. @returns `true` if `text/plain` data is present.
text(): string;Returns the stored plain text. @returns Decoded plain text, or an empty string if unavailable.
setText(text: string): void;Stores plain text using the `text/plain` MIME type. @param text Text to store.