CSV File Download from Lightning Component

Use below code to download data as a  CSV file from the lightning component.

Component 

Controller.js

helper.js

Sample App for testing