@zhaoshijun/compress 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/compressor.js +3 -1
package/package.json
CHANGED
package/src/core/compressor.js
CHANGED
|
@@ -31,7 +31,9 @@ export async function compressImage(input, options, filePath) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//
|
|
34
|
+
// 确保resize操作完成后再获取metadata
|
|
35
|
+
const resizedBuffer = await instance.toBuffer();
|
|
36
|
+
instance = sharp(resizedBuffer);
|
|
35
37
|
const resizedMetadata = await instance.metadata();
|
|
36
38
|
const format = resizedMetadata.format;
|
|
37
39
|
|