I use a library that accepts a file as one of its parameters and it uses something like
<input type="file" id="file" name="files"/> 
to get the needed file. Now, what i want is to send the file from my node.js server to the client via rest API like this:
$.get ('/getfile', function(data) {
    reader = new FileReader();
    reader.onload = function(theFile){
        //some code here
    };
    reader.readAsText(f); 
});
However, if i use something like this on the server side:
app.get('/getfile', function (req, res) {
    var pathx = 'path to file';
    res.download(pathx);
}); 
when it reaches the client, it does not see it as a file, rather the variable data, contains the contents of the file. how can i send a file down to the client so that the client can still see it as a file.
 
     
    