Is it possible to set transfer mode (binary or ascii) when calling `putFile`
marin-masic opened this issue · 1 comments
marin-masic commented
Hello.
We are uploading XML file (around 2 MB) via FTP using putFile
method, and sometimes XML file is malformed after upload.
That kind of issue can happen when using ASCII transfer mode for non-ASCII files.
Is it possible to set transfer mode when calling putFile
?
Thank you!
cprkv commented
I have same problem but when uploading big binary file (90 mb). After uploading I check md5 sum and every upload it is different. I changed transfer options to this dirty hack:
const chunkSize = 256 * 1024 * 1024;
const transferOptions = {
chunkSize,
step: (_total: number, nb: number, fsize: number): void => {
if (fsize > chunkSize) {
throw new Error(`file is too big: ${fsize}. Please increase chunk size`);
}
},
};
...
await con.putDirectory(buildDir, "/home/k/traktor", { transferOptions });
And now everything works as expected. It seems like chunked transfer is not working correctly. So this dirty hack disables it.