Every image I PUT() to a server using FTP client gets corrupted. I've tested with jpeg and png, all are damaged during transfer. Some characters are missing and some are displaced:
async sendImage(image) { try { const credentials = await getFtpCredentials(this.platform); console.log('Sending files via FTP client'); return new Promise((resolve, reject) => { let ftpClient = new ftp(); ftpClient.on('ready', () => { console.log(Putting ${image.path} onto server); // Set transfer type to binary ftpClient.binary(err => { if(err) reject(err); else // image.content is binary string data ftpClient.put(image.content, image.path, (err) => { if (err) { reject(err); } console.log('Closing FTP connection'); ftpClient.end(); resolve(FTP PUT for ${image.path} successful!`);
});
});
});
console.log('Connecting to FTP server');
ftpClient.connect(credentials);
});
`
Here's a copy of the image before sending over FTP and here's a corrupted copy after. Please compare the two using a binary editor or regular notepad. I hope this issue can be resolved as I like this library!
Every image I PUT() to a server using FTP client gets corrupted. I've tested with jpeg and png, all are damaged during transfer. Some characters are missing and some are displaced:
async sendImage(image) { try { const credentials = await getFtpCredentials(this.platform); console.log('Sending files via FTP client'); return new Promise((resolve, reject) => { let ftpClient = new ftp(); ftpClient.on('ready', () => { console.log(
Putting ${image.path} onto server); // Set transfer type to binary ftpClient.binary(err => { if(err) reject(err); else // image.content is binary string data ftpClient.put(image.content, image.path, (err) => { if (err) { reject(err); } console.log('Closing FTP connection'); ftpClient.end(); resolve(
FTP PUT for ${image.path} successful!`); });` Here's a copy of the image before sending over FTP and here's a corrupted copy after. Please compare the two using a binary editor or regular notepad. I hope this issue can be resolved as I like this library!
Thanks!