I am using Node.js to pull files from a remote server. I want to be able to download theses files anytime I pull put the file path. I have tried:
Connection and pull file
var Client = require('ssh2-sftp-client');
var sftp = new Client();
var remotePathToList = '/archiveFiles/file.wav';
sftp.connect({
host: '*******',
port: '22',
username: '******',
password: '******'
}).then(() => {
res.download(remotePathToList);
}).catch((err) => {
console.log(err, 'catch error');
But I get a "ENOENT: no such file or directory, stat "C:'/archiveFiles/file.wav'". But I am trying to download theses files from the remote server not my local desktop.