compress-jpeg 1.0.4 → 1.0.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/README.md +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Here's an example of how to integrate **compress-jpeg** with plain TypeScript in
|
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
62
|
// main.ts
|
|
63
|
-
import { ImageData as RustImageData, compress_jpeg } from "compress-jpeg";
|
|
63
|
+
import init, { ImageData as RustImageData, compress_jpeg } from "compress-jpeg";
|
|
64
64
|
|
|
65
65
|
const fileInput = document.getElementById("fileInput") as HTMLInputElement;
|
|
66
66
|
const originalCanvas = document.getElementById("originalCanvas") as HTMLCanvasElement;
|
|
@@ -70,6 +70,9 @@ fileInput.addEventListener("change", async () => {
|
|
|
70
70
|
const file = fileInput.files?.[0];
|
|
71
71
|
if (!file) return;
|
|
72
72
|
|
|
73
|
+
// Initialize the WASM module with an explicit path
|
|
74
|
+
await init("/compress_jpeg_bg.wasm");
|
|
75
|
+
|
|
73
76
|
// Load image into an off-screen canvas
|
|
74
77
|
const img = new Image();
|
|
75
78
|
const reader = new FileReader();
|