Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).

Getting file as a stream

no avatar
User

nyurik

Posts

1

Joined

Thu May 13, 2010 3:11 am

Getting file as a stream

by nyurik » Thu May 13, 2010 5:24 am

I am trying to unzip file as it is downloaded, by passing downloaded data stream directly into the decompressor. It would be easy if FTPClient.Get() would return a Stream object that I can pass on. Unfortunatelly, only FTPServer.Get(Stream,string) is available, that lets me put the content of the FTP file into the given stream. This defeats the purpose of Streams, as I have to create a MemoryStream or FileStream to temporarily hold the data, and if the file is large, it won't even fit into the MemoryStream.

I also noticed there is a protected virtual GetOutputStream(), but couldn't find any documentation.

Ideally, the code would look like this:


var gz = new GZipStream( FtpServer.GetStream(file), CompressionMode.Decompress );
// use gz as uncompressed data
no avatar
User

EDT Support

Posts

905

Joined

Mon Apr 26, 2004 3:03 pm

by EDT Support » Thu May 13, 2010 8:48 am

Yes that would be a nice feature. Our Java product already has it, but we haven't gotten around to adding it to our .NET version yet.

- Hans (EnterpriseDT)

Who is online

Users browsing this forum: No registered users and 12 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron