2

I have to read a file content or read the file bytes and need to store in it our database.

Using .NET System.IO.File we can simply call File.ReadAllBytes(file).

How to do it in WinSCP .NET assembly, using RemoteFileInfo?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Aditya Singh
  • 21
  • 1
  • 2

1 Answers1

3

The WinSCP .NET assembly supports providing the contents of a remote file using streams using the Session.GetFile method:

using (Stream stream = session.GetFile("/path/file.ext"))
{
    // use the stream
}
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992