Spaces:
Paused
Paused
Update loader.js
Browse files
loader.js
CHANGED
|
@@ -25,7 +25,9 @@ async function loadImg(source) {
|
|
| 25 |
if (!fs.existsSync(filePath)) {
|
| 26 |
throw new Error(`File tidak ditemukan di jalur: ${filePath}`);
|
| 27 |
}
|
| 28 |
-
const
|
|
|
|
|
|
|
| 29 |
return img;
|
| 30 |
}
|
| 31 |
} catch (error) {
|
|
|
|
| 25 |
if (!fs.existsSync(filePath)) {
|
| 26 |
throw new Error(`File tidak ditemukan di jalur: ${filePath}`);
|
| 27 |
}
|
| 28 |
+
const buffer = await fs.promises.readFile(filePath); // Baca file secara async
|
| 29 |
+
const img = new Image();
|
| 30 |
+
img.src = buffer; // Gunakan buffer untuk mengatur sumber
|
| 31 |
return img;
|
| 32 |
}
|
| 33 |
} catch (error) {
|