Ruloaooa commited on
Commit
9af3c03
·
verified ·
1 Parent(s): 80fcdcb

Update loader.js

Browse files
Files changed (1) hide show
  1. loader.js +3 -1
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 img = await loadImage(filePath);
 
 
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) {