quill-uploader
Version:
Quill custom Uploader, supports images, videos, and attachments, with customizable loading indicators.
45 lines (44 loc) • 1.24 kB
TypeScript
/**
* 生成一个精炼的随机字符串
* @param {number} length - 生成字符串的长度
* @returns {string} - 随机字符串
*/
export declare function randomString(length?: number): string;
/**
* 文件转为base64
*
* @param {File} file 文件对象
* @returns {Promise<string>} base64
*/
export declare function fileToBase64(file: File): Promise<string>;
export interface VideoCaptureOptions {
time?: number;
quality?: number;
type?: string;
}
export interface VideoInfo {
thumb: string;
duration: number;
width: number;
height: number;
}
/**
* 获取视频信息
*
* @param {string|File} url 文件对象或地址
* @returns {Promise<object>} { thumb, duration, width, height }
*/
export declare function getVideoInfo(url: string | File, captureOpts?: VideoCaptureOptions): Promise<VideoInfo>;
export declare function captureVideo(video: HTMLVideoElement, opts?: {
quality?: number;
type?: string;
}): string;
/**
* 将base64转换为file文件
*
* @export
* @param {String} dataUrl base64图片
* @param {String} filename 生成文件名,默认随机
* @returns {File} 文件对象
*/
export declare function dataURLtoFile(dataUrl: string, filename?: string): File;