I'm having an issue with a project I'm working on whereby I'm downloading files from my FTP server using a node module called sftp-ssh2-client and then trying to pass the stream back into my FTP server but into a different directory.
The code looks like this:
const stream = sftp.get(`path/to/file.csv.gz`).then(() => {
}).catch((err) => {
});
sftp.put(stream, 'path/to/new/file.csv.gz').then(() => {
}).catch((err) => {
})
However, when I dial into my FTP server to the location where the file has been PUT to, the file size is 0 and when downloaded is corrupted. Can anyone tell me what I'm doing wrong here?
Many thanks,
G