# How to extract image from wix-fetch response?

**URL:** <https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781>\
**Category:** Ask the community\
**Tags:** wix-fetch, api, code\
**Created:** [June 7, 2024, 10:32pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781 "2024-06-07T22:32:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![PicsGenie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/picsgenie/32/89438_2.png) [@PicsGenie](https://forum.wixstudio.com/u/PicsGenie)\
**Post date:** [June 7, 2024, 10:32pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/1 "2024-06-07T22:32:13Z")

</div>

Hi! I’m facing a pretty difficult challenge with wix-fetch.

The goal is to send an image from my site frontend to an edit API, receive the modified image, and display it. So far I have no trouble sending the image with a POST, and I know the API modifies it correctly.

The problem is with wix-fetch. There seems to be no way to get an image from the WixFetchResponse object-- the [only two decoding methods](https://www.wix.com/velo/reference/wix-fetch/wixfetchresponse) are .json() which doesn’t work, and .text() which produces this:

 ![image](https://us1.discourse-cdn.com/wix/original/3X/f/b/fb63173681afc75074d0d2ca029f00975b446f6b.png)

Somehow I need to get the (what I assume is binary) data of the png and turn it into an actual PNG. I think the .text() is corrupting everything irreversibly though!

Here’s some code for reference:  
 ![image](https://us1.discourse-cdn.com/wix/original/3X/5/f/5fb31016d8e443c2e8aeff8cf6cb616cb3c14318.png)

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [June 10, 2024, 6:59pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/2 "2024-06-10T18:59:59Z")

</div>

Wix-fetch doesn’t support this. You can use another HTTP library such as axios.

Stackoverflow [suggests](https://stackoverflow.com/questions/49040247/download-binary-file-with-axios) something like this should work:

```js
axios.get('/file.pdf', {
      responseType: 'arraybuffer'
})

```

Libraries can be installed using Wix Studio’s package manager: [Working with npm Packages](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/working-with-npm-packages)

---

<div class="post-metadata">

**Author:** ![PicsGenie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/picsgenie/32/89438_2.png) [@PicsGenie](https://forum.wixstudio.com/u/PicsGenie)\
**Post date:** [June 11, 2024, 2:19am UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/3 "2024-06-11T02:19:41Z")

</div>

Thanks for the reply @anthony! Unfortunately Axios and pretty much any request library seem to not be approved for install via the Wix NPM package manager. Any idea on how I could get it approved? I’m pretty surprised this stuff isn’t allowed/supported.

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [June 11, 2024, 2:22pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/4 "2024-06-11T14:22:57Z")

</div>

Can you share a screenshot and any error messages you’re getting on the console? I’m able to install axios and similar libraries.

 ![image](https://us1.discourse-cdn.com/wix/original/3X/f/f/ffa225e182e15b15eb7c2639ceb57007364d42c7.png)  
 ![image](https://us1.discourse-cdn.com/wix/original/3X/1/d/1df816ea1ae555fb711b7d5c0304ba549ee8f8aa.png)

---

<div class="post-metadata">

**Author:** ![PicsGenie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/picsgenie/32/89438_2.png) [@PicsGenie](https://forum.wixstudio.com/u/PicsGenie)\
**Post date:** [June 11, 2024, 6:36pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/5 "2024-06-11T18:36:21Z")

</div>

Sure thing @anthony,

Here’s me trying to install axios:

 ![image](https://us1.discourse-cdn.com/wix/original/3X/7/3/73c2c768d1b30f644c2f06effdb21bf9bedf4b5e.png)

And needle:

 ![image](https://us1.discourse-cdn.com/wix/original/3X/1/2/1246f210998edb0deb8d6311ba264bb8787d6277.png)

For reference I have been able to install packages in the past. Here’s Buffer:  
 ![image](https://us1.discourse-cdn.com/wix/original/3X/9/0/90a52df094e502845ac37b533fd9d6b367751ec0.png)

 ![image](https://us1.discourse-cdn.com/wix/original/3X/c/6/c64c1f1eb4e6fd19c03f1d57b5a0b03f50be4685.png)

It’s always struck me as strange how many packages aren’t marked with “install” for me… any thoughts?

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [June 11, 2024, 7:36pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/6 "2024-06-11T19:36:43Z")

</div>

That is very weird. I think this is a bug. Best place to report this is customer care: [https://www.wix.com/support-chatbot?nodeId=aedad5ab-8cdd-4c3a-94e9-7a6e3f96835e&referral=bugReportForum](https://www.wix.com/support-chatbot?nodeId=aedad5ab-8cdd-4c3a-94e9-7a6e3f96835e&referral=bugReportForum)

I’ll raise internally as well. What browser and version are you using? Also I assume this is the Wix editor and not Wix Studio?

---

<div class="post-metadata">

**Author:** ![PicsGenie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/picsgenie/32/89438_2.png) [@PicsGenie](https://forum.wixstudio.com/u/PicsGenie)\
**Post date:** [June 11, 2024, 7:52pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/7 "2024-06-11T19:52:55Z")

</div>

I’m using Firefox 126.0.1 (64-bit) on Windows 10. Yes, it’s Wix Editor.

Just tested on Chrome and it works!

 ![image](https://us1.discourse-cdn.com/wix/original/3X/3/3/33225396abfa977b001ec7cb8640ea5a799bfebb.png)

Glad to hear it’s a bug not a feature-- apparently the browser is what’s been causing me a headache this whole time. Thanks!

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [June 11, 2024, 8:09pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/8 "2024-06-11T20:09:24Z")

</div>

Awesome! Glad we got that figured out!

---

<div class="post-metadata">

**Author:** ![PicsGenie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/picsgenie/32/89438_2.png) [@PicsGenie](https://forum.wixstudio.com/u/PicsGenie)\
**Post date:** [June 11, 2024, 9:11pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/9 "2024-06-11T21:11:07Z")

</div>

@anthony thanks for the help! Much appreciated 🙂

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [June 13, 2024, 3:28pm UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/10 "2024-06-13T15:28:58Z")

</div>

@PicsGenie Question, what version of Firefox were you using when you encountered this issue? And any plugins such as ad blockers?

---

<div class="post-metadata">

**Author:** ![PicsGenie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/picsgenie/32/89438_2.png) [@PicsGenie](https://forum.wixstudio.com/u/PicsGenie)\
**Post date:** [June 14, 2024, 4:40am UTC](https://forum.wixstudio.com/t/how-to-extract-image-from-wix-fetch-response/59781/11 "2024-06-14T04:40:13Z")

</div>

I was using Firefox 126.0.1 (64-bit) on Windows 10 for the Wix Editor. I had AdBlocker Ultimate installed
