Category Archives: JavaScript

Triggering download of file using JavaScript

I recently needed to write a small piece of download code. So you pass in the ID of the document to a REST API and it should give you back a blob of the actual file. The problem however is how to actually save this blob of binary data into a local file. So a quick Googling threw up some interesting links which I finally used to finalize my solution.

Code to detect file name

Code to trigger download