How can i show binary image from fetch response?

const photoUrl = ''
fetch(photoUrl, {
    method: 'GET',
    console.log('first res');
      console.log('render ')
      console.log(image.path) = image.path;
      console.log('second res');
        console.log('render ')
        console.log(image.path) = image.path;

Above url returns image binary. (image/png content type response). How can I shows the response image to <Image/> tag?
this code throws empty err ({} of object type.) and doesn’t execute callback function passed to getImageFromBase64.

Hi dhguswns23,

there are several things wrong with the code you posted, and I wasn’t able to get it working either.

First, you need to put "Fuse.ImageTools" in the "Packages" section of your .unoproj file. Then, you need to put var ImageTools = require("FuseJS/ImageTools"); at the top of your JavaScript code.

Those would be the prerequisites.

Next, there is no saying what in that snippet is. Now, if you’re setting the .value or a photoUrl variable, wouldn’t it be fair if you showed where that variable is defined, exported and how do you use it in UX?

Next, the snippet itself looks faulty. I tried to clean it up a little so you can see what chains on what:

    var ImageTools = require("FuseJS/ImageTools");
    const photoUrl = '';
    fetch(photoUrl, {
        method: 'GET',
    }).then(function(response) {
        return response._bodyText;
    }).then(function(data) {
        console.log('second res: ' + JSON.stringify(data));
        ImageTools.getImageFromBase64(data).then(function(image) {
            // = image.path;
    }).catch(function(err) {
        console.log('err: ' + err.message);

And this brings us to the final issue - the string in _bodyText and _bodyInit is not a valid base64. Not only that, the request itself returns with a 400 error code, so you probably can’t run it like that. And since you’re calling it against Google Maps Places API, I think you can find an answer how to do it right on their docs.

If you need further assistance after you have solved all of the issues outlined above, please post a complete, minimal reproduction (think: single UX-file app) that can be copy-pasted and run.