First, the file can be downloaded via a template node form submission. So file download is not the problem.
But how to link the dashboard button to file download? That is: If a person clicks the download button, the the file will be downloaded. I know this might be simple but I can't fine an answer
The following is the flow:
[{"id":"6f7ed72f.4ba6b8","type":"debug","z":"c37fcc5b.b6edb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":910,"y":840,"wires":[]},{"id":"8a4440e7.4e8e7","type":"http in","z":"c37fcc5b.b6edb","name":"","url":"/data.csv","method":"get","upload":false,"swaggerDoc":"","x":590,"y":900,"wires":[["4fa2d392.0122bc"]]},{"id":"4fa2d392.0122bc","type":"file in","z":"c37fcc5b.b6edb","name":"","filename":"/home/pi/.node-red/public/data.csv","format":"","sendError":true,"x":880,"y":900,"wires":[["d659f021.5555f8"]]},{"id":"d659f021.5555f8","type":"http response","z":"c37fcc5b.b6edb","name":"","statusCode":"","headers":{},"x":1110,"y":900,"wires":[]},{"id":"f97e6e7e.09b18","type":"ui_button","z":"c37fcc5b.b6edb","name":"","group":"c4536f8a.ffdf5","order":2,"width":0,"height":0,"passthru":false,"label":"Download data","tooltip":"","color":"","bgcolor":"","icon":"","payload":"<a href=\"/data.csv\">","payloadType":"str","topic":"","topicType":"str","x":530,"y":840,"wires":[["d62d8837.b25338"]]},{"id":"d62d8837.b25338","type":"ui_template","z":"c37fcc5b.b6edb","group":"c4536f8a.ffdf5","name":"","order":16,"width":0,"height":0,"format":"<script>\n(function(scope) {\n scope.$watch('msg', function(msg) {\n if (msg) \n {\n\n // what will be the code here?\n \n \n }\n });\n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":720,"y":840,"wires":[["6f7ed72f.4ba6b8"]]},{"id":"c4536f8a.ffdf5","type":"ui_group","name":"Data Export","tab":"71b53261.d60bec","order":2,"disp":true,"width":"12"},{"id":"71b53261.d60bec","type":"ui_tab","name":"Broadcasting temperature","icon":"dashboard","order":2,"disabled":false,"hidden":false}]