# Does fetch in Xd support the .blob() or .arrayBuffer() methods on the response body?

**URL:** <https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396>\
**Category:** UXP Plugin API\
**Created:** [November 14, 2018, 2:56pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396 "2018-11-14T14:56:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [November 14, 2018, 2:56pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/1 "2018-11-14T14:56:33Z")

</div>

Using

await fetch(url)

to get a png image from the web (which succeeds, as the resulting response has normal status (OK), content-length is 46653, etc.

Using .json() complains rightly that it’s not a json-formatted response, but .blob is undefined, and .arrayBuffer() just returns empty.

So I’m suspecting that Xd’s fetch isn’t a full implementation? Can you confirm?

This is a real problem if so.

---

<div class="post-metadata">

**Author:** ![stevekwak](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/stevekwak/32/48_2.png) [@stevekwak](https://forums.creativeclouddeveloper.com/u/stevekwak)\
**Post date:** [November 14, 2018, 3:51pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/2 "2018-11-14T15:51:26Z")

</div>

blob is not supported currently. For fetching images, please consider using XHR for now. Here is an example! [https://github.com/AdobeXD/plugin-samples/blob/master/how-to-make-network-requests/main.js](https://github.com/AdobeXD/plugin-samples/blob/master/how-to-make-network-requests/main.js)

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [November 14, 2018, 3:55pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/3 "2018-11-14T15:55:06Z")

</div>

Great, thanks!

Can you add those to the wish-list for fetch()?

---

<div class="post-metadata">

**Author:** ![stevekwak](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/stevekwak/32/48_2.png) [@stevekwak](https://forums.creativeclouddeveloper.com/u/stevekwak)\
**Post date:** [November 15, 2018, 3:43pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/4 "2018-11-15T15:43:06Z")

</div>

blob support is coming soon! ref: [https://trello.com/b/WFKmCVaz/xd-extensibility-roadmap](https://trello.com/b/WFKmCVaz/xd-extensibility-roadmap)

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [November 15, 2018, 4:25pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/5 "2018-11-15T16:25:30Z")

</div>

Great, thanks!

Also, what about ImageFill taking more than just a file ref or data: url? How about a binary blob as well, like what you’d get directly from fetching a url for a .png/.jpg/.gif?

---

<div class="post-metadata">

**Author:** ![alexandrtovmach](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/alexandrtovmach/32/824_2.png) [@alexandrtovmach](https://forums.creativeclouddeveloper.com/u/alexandrtovmach)\
**Post date:** [May 15, 2020, 5:42pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/6 "2020-05-15T17:42:32Z")

</div>

Nice example, but I tested it, and seems like it’s not working…  
I’m getting this error:  
`Plugin InvalidStateError: responseType should be the empty string or "text"`

---

<div class="post-metadata">

**Author:** ![alexandrtovmach](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/alexandrtovmach/32/824_2.png) [@alexandrtovmach](https://forums.creativeclouddeveloper.com/u/alexandrtovmach)\
**Post date:** [May 15, 2020, 6:09pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/7 "2020-05-15T18:09:22Z")

</div>

I figured out the way how it works 🎉

```auto
// Working example
const response = await fetch(url, {
  headers: new Headers({
    'x-requested-with': 'AdobeXD Desktop'
  })
});
const buffer = await response.arrayBuffer();

```

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [May 15, 2020, 6:13pm UTC](https://forums.creativeclouddeveloper.com/t/does-fetch-in-xd-support-the-blob-or-arraybuffer-methods-on-the-response-body/396/8 "2020-05-15T18:13:40Z")

</div>

@kerrishotts or @peterflynn How close is blob support now?
