# mmyhs-utils **Repository Path**: mmyhs/mmyhs-utils ## Basic Information - **Project Name**: mmyhs-utils - **Description**: 前端常用工具包,比如图片压缩,会持续集成 - **Primary Language**: TypeScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-28 - **Last Updated**: 2024-04-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 工具包 ## compressPicture 压缩图片 | 参数 | 说明 | 默认值 | | -------------- | ------------------------------------------------------------ | ------ | | compressMaxNum | 最大压缩次数 | 3 | | quality | 压缩质量 | 0.8 | | maxWidth | 压缩后的图片最大宽度,0代表保持原图大小 | 800 | | maxSize | 单位kb, 压缩后图片的最大大小,如果填写的是 -1 那么就只看 compressMaxNum 的次数 | 1024 | ```js compressPicture(file,{ compressMaxNum:3, quality:0.8, maxWidth:800, maxSize:1024 }).then(res=>{ console.log(res) }) ``` ## random 随机生成一定范围的数字 ```js random(min,max) ```