Monthly Archives: June 2018

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

Fractal Folders

I have asked myself this question a number of times. What is the best possible way to structure my UI code? Should I cluster the files using functionality or by the type of file? etc. etc.

I found a partial answer in Fractal Folders while learning ReactJS. This basically proposes that for an UI page there are many functionalities which it is comprised of and the artefacts related to these sub-functionality should be clustered as sub-folders.