I have web application where on button click invoking REST API which fetch list of files available in ftp server and displayed in div with hyperlink on file name as below.
for this I am using jsftp module.
ftp.ls(".", function(err, res) { res.forEach(function(file) { console.log(file.name); //logic to display in div }); }); I have another REST API for download file from FTP server which invoked on file name click present in div but it is downloaded in local directory where web application deploy and not in users system with below code, but I want when user click on file name that file should download in users system or computer. How I can achieve this.
ftp.get('remote/file.txt', 'local/file.txt', function(hadErr) { if (hadErr) console.error('There was an error retrieving the file.'); else console.log('File copied successfully!'); });