UNPKG

matrix-react-sdk

Version:
31 lines (30 loc) 1.81 kB
import { FileSizeOptionsArray, FileSizeOptionsBase, FileSizeOptionsExponent, FileSizeOptionsObject, FileSizeOptionsString, FileSizeReturnArray, FileSizeReturnObject } from "filesize"; import { MediaEventContent } from "matrix-js-sdk/src/types"; export declare function downloadLabelForFile(content: MediaEventContent, withSize?: boolean): string; /** * Extracts a human-readable label for the file attachment to use as * link text. * * @param {MediaEventContent} content The "content" key of the matrix event. * @param {string} fallbackText The fallback text * @param {boolean} withSize Whether to include size information. Default true. * @param {boolean} shortened Ensure the extension of the file name is visible. Default false. * @return {string} the human-readable link text for the attachment. */ export declare function presentableTextForFile(content: MediaEventContent, fallbackText?: string, withSize?: boolean, shortened?: boolean): string; /** * wrapper function to set default values for filesize function * * @param byteCount size of file * @param options options to customize the response type or size type conversion e.g. 12kB, 12KB * @returns {string | number | any[] | { * value: any; * symbol: any; * exponent: number; * unit: string;}} formatted file size with unit e.g. 12kB, 12KB */ export declare function fileSize(byteCount: number, options: FileSizeOptionsString | FileSizeOptionsBase): string; export declare function fileSize(byteCount: number, options: FileSizeOptionsArray): FileSizeReturnArray; export declare function fileSize(byteCount: number, options: FileSizeOptionsExponent): number; export declare function fileSize(byteCount: number, options: FileSizeOptionsObject): FileSizeReturnObject; export declare function fileSize(byteCount: number): string;