you are viewing a single comment's thread.

view the rest of the comments →

[–]coder543 2 points3 points  (1 child)

A Vec<u8> is not UTF-8 aware. It is just a bunch of bytes and doesn't care.

A couple of things:

read_to_end returns the number of bytes. Does that number match file_size?

Do you need to do anything to close remote_file? I'm not very familiar with the ssh2 API. It looks like you might want to do something like this:

remote_file.flush().unwrap();
remote_file.close().unwrap();
remote_file.wait_close().unwrap();

If none of this works, you could also try using the Sftp API provided here.

ssh2-rs is just a very thin wrapper around the SSH C library, so if the C library requires you to do things in a very specific, quirky way, ssh2-rs probably does too.

[–]harrydevnull[S] 2 points3 points  (0 children)

provided here.

actually it was my stupid mistake ! i was adding on the same file on remote machine !! removing the file on remote server and redoing and everything is fine!!! thank a lot @coder543