/** * 将KB转换为可读的文件大小格式 * 支持从字节(B)到TB的所有单位,最小单位为B * * @param {number} kb - 文件大小(KB) * @returns {string} 格式化后的文件大小字符串 * * @example * kbToSize(1073741824) // "1 TB" * kbToSize(1048576) // "1 GB" * kbToSize(1024) // "1 MB" * kbToSize(512) // "512 KB" * kbToSize(1) // "1 KB" * kbToSize(0.5) // "512 B" * kbToSize(0.1) // "102.4 B" * kbToSize(0.0001) // "0.1 B" * kbToSize(0) // "0 B" */ export declare const kbToSize: (kb: number) => string; /** * 检查文件是否为图片类型 * 通过 MIME 类型和文件扩展名双重判断 * * @param {File} file - 要检查的文件 * @returns {boolean} 是否为图片文件 */ export declare const isImageFile: (file: File) => boolean; /** * 获取设备品牌 * * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent * @returns {string | false} 设备品牌名称,如果无法匹配则返回 false * * @example * ```ts * getDeviceBrand() // 'vivo' | '华为' | 'iphone' | false * getDeviceBrand('Mozilla/5.0...vivo...') // 'vivo' * ``` */ export declare const getDeviceBrand: (ua?: string) => string | false; /** * 检测是否为 vivo 手机 * * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent * @returns {boolean} 是否为 vivo 设备 * * @example * ```ts * isVivoDevice() // true | false * ``` */ export declare const isVivoDevice: (ua?: string) => boolean; /** * 检测是否为 oppo 手机 * * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent * @returns {boolean} 是否为 oppo 设备 * * @example * ```ts * isOppoDevice() // true | false * ``` */ export declare const isOppoDevice: (ua?: string) => boolean; /** * 检测是否为 vivo 或 oppo 手机 * * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent * @returns {boolean} 是否为 vivo 或 oppo 设备 * * @example * ```ts * isVivoOrOppoDevice() // true | false * ``` */ export declare const isVivoOrOppoDevice: (ua?: string) => boolean; /** * 检测是否为移动设备 * * @returns {boolean} 是否为移动设备 * * @example * ```ts * isMobileDevice() // true | false * ``` */ export declare const isMobileDevice: () => boolean; /** * 检测是否为微信环境 * * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent * @returns {boolean} 是否为微信环境 * * @example * ```ts * isWeChat() // true | false * ``` */ export declare const isWeChat: (ua?: string) => boolean;