Downloads the file from the FTP server and writes the contents
to the OutputStream.
Namespace: Jscape.FtpAssembly: Jscape.Ftp (in Jscape.Ftp.dll) Version: 2.4.5.0
Syntax
C# |
---|
public virtual void Download( Stream streamOut, string remoteFile ) |
Visual Basic |
---|
Public Overridable Sub Download ( _ streamOut As Stream, _ remoteFile As String _ ) |
Visual C++ |
---|
public: virtual void Download( Stream^ streamOut, String^ remoteFile ) |
Parameters
- streamOut
- Type: System.IO..::..Stream
The OutputStream to write the contents.
- remoteFile
- Type: System..::..String
The remote filename.
Examples
This example gets the contents of the remote file test.txt.
It is assumed the remote file already exists.
CopyC#
Copy

// test.txt contents = "This is a memory stream test.\r\n" string rFile = "test.txt"; int buffersize = Convert.ToInt32(myFtp.GetFileSize(rFile)); // create memory stream MemoryStream bout = new MemoryStream(buffersize); // download remote file myFtp.Download(bout, rFile); // get memory stream buffer byte[] buffer = bout.GetBuffer();

' test.txt contents = 'This is a memory stream test.\r\n' Dim rFile As String = "test.txt" Dim buffersize As Double = Convert.ToDouble(myFtp.GetFileSize(rFile)) ' create memory stream Dim bout As System.IO.MemoryStream = New System.IO.MemoryStream(buffersize) ' download remote file myFtp.Download(bout, rFile) ' get memory stream buffer Dim buffer As Byte() = bout.GetBuffer()
Exceptions
Exception | Condition |
---|---|
Jscape.Ftp..::..FtpException | If an I/O or FTP error occurs. |