aseli commited on
Commit
4d47368
1 Parent(s): 44ed890

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +2 -2
index.js CHANGED
@@ -83,7 +83,7 @@ app.get('/qrcode', async (req, res) => {
83
  });
84
  } else if (['read', 'scan'].includes(mode)) {
85
  // Fetch the image and read the QR code
86
- const response = await fetch(url);
87
  if (!rts.ok || rts.status !== 200) return res.send({
88
  status: 400,
89
  message: 'Can\'t buffer url'
@@ -92,7 +92,7 @@ app.get('/qrcode', async (req, res) => {
92
  status: 400,
93
  message: 'Only image type'
94
  })
95
- const buffer = Buffer.from(await response.arrayBuffer());
96
  const image = await Jimp.read(buffer);
97
 
98
  // Preprocess the image to enhance QR code readability
 
83
  });
84
  } else if (['read', 'scan'].includes(mode)) {
85
  // Fetch the image and read the QR code
86
+ const rts = await fetch(url);
87
  if (!rts.ok || rts.status !== 200) return res.send({
88
  status: 400,
89
  message: 'Can\'t buffer url'
 
92
  status: 400,
93
  message: 'Only image type'
94
  })
95
+ const buffer = Buffer.from(await rts.arrayBuffer());
96
  const image = await Jimp.read(buffer);
97
 
98
  // Preprocess the image to enhance QR code readability