Support for MemoryStreams

Jan 9, 2008 at 7:17 AM
I have an application where if I'm careful... I don't need to write anything to the FS.

I was wondering how difficult it would be to add support for loaded a zip as a byte[] or MemoryStream?

I downloaded the source and started to try it but ran into problems right away, a bit over my head right now. I will use the j# stuff to get my project rolling but I like your library and would rather use it.

-Steve
Coordinator
Jan 30, 2008 at 11:17 PM
I don't know exactly what you want. Could you elaborate on what you want to do?
do you want to extract an entry from a ziparchive, into a memory stream? If so, you can do that today with ZipEntry.Extract(System.IO.Stream s) .

do you want to Create a zipfile that does not get written to the disk?
Jan 31, 2008 at 1:46 AM
I want read zip-file stream from ftp server, but don't download the zip-file from the ftp server.
Jan 31, 2008 at 7:07 AM

Cheeso wrote:
I don't know exactly what you want. Could you elaborate on what you want to do?
do you want to extract an entry from a ziparchive, into a memory stream? If so, you can do that today with ZipEntry.Extract(System.IO.Stream s) .

do you want to Create a zipfile that does not get written to the disk?

Hi,

Apologies for not being clear. After reading my post I can see that it lacks sufficient detail (and spelling and grammar issues!).
I have a zip archive as a byte[] from a database. I would like extract the entries (files) from this archive without saving the archive to a temp file on disk. Additionally I would like to extract the files to a byte[] (or MemoryStream).

Here is a pseudo code sample:
//  Loading aarchive data as a byte[] from the database, then
//  constructing a ZipFile object
byte[] archive = GetArchiveFromDataBase();
ZipFile zipFile = new ZipFile(archive);
 
//  I forget the syntax and design of your component, the idea is
//  I'm pulling a file from the archive out as a byte[]
byte[] firstFileInArchiveData = zipFile.Extract(0);

So that's it in a nutshell. Hope that makes more sense.

Thanks,
Steve
Coordinator
Jan 31, 2008 at 3:21 PM
mmkay, that makes sense to me. Now I understand.
The first requirement - extract from a byte[] or memory stream - that makes sense and you cannot do it today.
As for the second requirement, I Think you can extract to a memory stream today, yes? anything else we need to do?

this shouldn't be hard to implement. I'll let you know.
Coordinator
Jan 31, 2008 at 3:22 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jan 31, 2008 at 6:49 PM

Cheeso wrote:
mmkay, that makes sense to me. Now I understand.
The first requirement - extract from a byte[] or memory stream - that makes sense and you cannot do it today.
As for the second requirement, I Think you can extract to a memory stream today, yes? anything else we need to do?

this shouldn't be hard to implement. I'll let you know.


I don't have your sample code installed on my current machine, but yes, it does sound familiar that I can extract TO a MemoryStream which would work. I could easily take it a step further and wrap your component with a service layer to transform the interface to my specific needs.

I'm glad to see you are open to my suggestion. I would have liked to have made the changes myself and contribute but it looked like it was going to take more time than I had available.

Thanks for the quick response, I'll subscribe to the work item (if that's possible) so I know when/if it's done.

Have a good one,
Steve
Coordinator
Feb 1, 2008 at 1:29 AM
Fixed in changeset 14425.
Feb 1, 2008 at 5:15 AM

Cheeso wrote:
Fixed in changeset 14425.

Right on! That was fast.

I downloaded the latest and am trying to add the library project to me solution. When I add it it's asking for a key file password. I checked the license and read me for the password but didn't see anything.

Am I missing it somewhere? I searched for the discussion forum and also didn't find anything.

-Steve
Coordinator
Feb 1, 2008 at 4:31 PM
It's in the ReadThis.txt file in the Library directory.
Password for the pfx file is IonicShade