2

I have a web service call that returns {"data": BINARYDATA}. How can I pop up a dialog to download the file based on only those binary data? It could be a file of any type. I'm probably looking for a Javascript function, or maybe a browser-specific function? Thanks.

EDIT: I am checking to see how the data are encoded. Will update soon with that (important) information.

EDIT 2: I investigated Using HTML5/Javascript to generate and save a file . Thank you for the referral. My main problem with the dataURI method is that my files are larger than 256kB

Community
  • 1
  • 1
Miriam
  • 969
  • 1
  • 6
  • 15

1 Answers1

1

Resolved:

The answer is that this is not a good client-side task (particularly when dealing with large files). It's much better to change the server-side code to return the appropriate HTTP response (with headers) instead of JSON.

Thanks everyone for your help in the comments.

Miriam
  • 969
  • 1
  • 6
  • 15