wasm-image-optimization 2.0.0 → 2.0.2

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/dist/workers.js CHANGED
@@ -32,9 +32,14 @@ const createImageConverterWorker = (params) => {
32
32
  get(target, prop, receiver) {
33
33
  if (prop === "optimizeImage") {
34
34
  return async (options) => {
35
+ const image = options.image instanceof Uint8Array
36
+ ? options.image
37
+ : typeof options.image === "string"
38
+ ? new TextEncoder().encode(options.image)
39
+ : new Uint8Array(options.image);
35
40
  return await target.execute("optimizeImage", {
36
41
  ...options,
37
- image: new Uint8Array(options.image),
42
+ image,
38
43
  });
39
44
  };
40
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-image-optimization",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Optimize images with wasm on edge runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",