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


#1

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.


#2

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


#3

Great, thanks!

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


#4

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


#5

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?