@zhaoshijun/compress 1.2.0 → 1.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhaoshijun/compress",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Image compression CLI and Vite plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -204,7 +204,8 @@ export async function addImageWatermark(sharpInstance, options) {
204
204
  throw new Error(`Watermark image not found: ${watermarkPath}`);
205
205
  }
206
206
 
207
- let watermarkImage = sharp(watermarkPath);
207
+ const watermarkBuffer = await fs.readFile(watermarkPath);
208
+ let watermarkImage = sharp(watermarkBuffer);
208
209
  const watermarkMeta = await watermarkImage.metadata();
209
210
 
210
211
  if (width || height) {
@@ -321,7 +322,8 @@ export async function addTiledImageWatermark(sharpInstance, options, providedMet
321
322
  throw new Error(`Watermark image not found: ${watermarkPath}`);
322
323
  }
323
324
 
324
- let watermarkImage = sharp(watermarkPath);
325
+ const watermarkBuffer = await fs.readFile(watermarkPath);
326
+ let watermarkImage = sharp(watermarkBuffer);
325
327
  const watermarkMeta = await watermarkImage.metadata();
326
328
 
327
329
  if (width || height) {