How to transfer binary file in SFTP? Will it be same as normal file? Or is there any different process?
Answer. There is no equivalent option in SFTP. The RepresentationType field does not exist in SFTP. All data is sent in BINARY mode, so that the server will receive exactly the same data as that which is sent from the client.
SFTP supports two transfer methods: ASCII and binary.
A binary file is a normal file.
You are possibly referring to a text/ascii vs. a binary transfer mode, known from an FTP protocol. The FTP protocol defaults to the text/ascii mode, so one usually had to ensure that the mode was switched to the binary not to corrupt the transferred binary files.
SFTP protocol also supports a text/ascii vs. binary mode distinction in its newer versions. Though contrary to the FTP, the binary mode is the default and one has to explicitly force the text/ascii mode, if desired.
Moreover the ascii/text mode is supported by an SFTP version 4 and newer only. And many SFTP servers/clients (including the most widespread one, the OpenSSH) support an SFTP version 3 only. So they will not even let you use the text/ascii mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With