Skip to content

Commit 4a1da8c

Browse files
authored
fix: type define of compress.ts (#498)
1 parent 2d474dc commit 4a1da8c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ qiniu.compressImage(file, options).then(data => {
252252
```JavaScript
253253
const imgLink = qiniu.compressImage(file, options).then(res => {
254254
// res : {
255-
// dist: 压缩后输出的 File 对象,或原始的 file,具体看下面的 options 配置
255+
// dist: 压缩后输出的 Blob 对象或原始的 File 对象,具体看下面的 options 配置
256256
// width: 压缩后的图片宽度
257257
// height: 压缩后的图片高度
258258
// }
@@ -267,7 +267,7 @@ qiniu.compressImage(file, options).then(data => {
267267
(注意:当 `maxWidth``maxHeight` 都不设置时,则采用原图尺寸大小)
268268
* options.noCompressIfLarger: `boolean`,为 `true` 时如果发现压缩后图片大小比原来还大,则返回源图片(即输出的 dist 直接返回了输入的 file);默认 `false`,即保证图片尺寸符合要求,但不保证压缩后的图片体积一定变小
269269
* CompressResult: `object`,包含如下字段:
270-
* dist: 压缩后输出的 File 对象,或原始的 file,具体看下面的 options 配置
270+
* dist: 压缩后输出的 Blob 对象或原始的 File 对象
271271
* width: 压缩后的图片宽度
272272
* height: 压缩后的图片高度
273273

src/compress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface Dimension {
1414
}
1515

1616
export interface CompressResult {
17-
dist: Blob
17+
dist: Blob | File
1818
width: number
1919
height: number
2020
}

0 commit comments

Comments
 (0)