Custom QR Code with Logo

PAID
By qrcode-monkey | Updated 9 days ago | Tools
Popularity

9.8 / 10

Latency

668ms

Service Level

98%

Health Check

N/A

Back to All Discussions

Decode Image Reponse

Rapid account: Crowd Connect Admin
CrowdConnectAdmin
4 years ago

Hi

How can i decode the response?

I used NodeJs and here is my code for decoding the response

    var encodedImage = new Buffer.from(result.body, 'binary').toString('base64');

res.end("<html><body>" +
"<img src=“data:image/png;base64,” + encodedImages + “” />" +
"</body></html>");
});

Rapid account: Kaung A Eq A 6 Fuci
kaung-aEqA6Fuci Commented 4 years ago

I faced a similar issue accept I’m trying to write to blob storage but the response from the POST doesn’t get me a valid binary, or atleast I don’t have a clear way inspecting how I can convert this to png. I used the GET method and it works fine.

const axios = require('axios');
const fs = require('fs');

axios({
  method: "GET",
  url: "https://qrcode-monkey.p.rapidapi.com/qr/custom",
  headers: {
    "content-type": "application/octet-stream",
    "x-rapidapi-host": "some_host",
    "x-rapidapi-key": "some_key",
    "useQueryString": true
  },
  params: {
    size: "600",
    file: "png",
    data: "https://www.qrcode-monkey.com"
  },
  responseType: 'stream',
})
.then((response) => {
  response.data.pipe(fs.createWriteStream('qr.png'));
})
.catch((error) => {
  console.log(error);
})
Rapid account: Facepass
facepass Commented 4 years ago

I save the file with fs.writeFile(‘qrcode.png’,res.body,‘binary’,function(err){ … but it’s unreadable

Rapid account: Regas Huhu
regas.huhu Commented 4 years ago

Can i get for free ?

Rapid account: Regas Huhu
regas.huhu Commented 4 years ago

No comment

Rapid account: Qrcode Monkey
qrcode-monkey Commented 4 years ago

Hello, I do not know the exact way to handle it in NodeJS. But you get the binary data as response from the request. Did you try to save it as a file instead of showing it directly via base64?

Join in the discussion - add comment below:

Login / Signup to post new comments