Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a Stream without having a physical file to create from

Tags:

I'm needing to create a zip file containing documents that exist on the server. I am using the .Net Package class to do so, and to create a new Package (which is the zip file) I have to have either a path to a physical file or a stream. I am trying to not create an actual file that would be the zip file, instead just create a stream that would exist in memory or something.

My question is how do you instantiate a new Stream (i.e. FileStream, MemoryStream, etc) without having a physical file to instantiate from.

like image 625
jhorton Avatar asked Apr 12 '10 15:04

jhorton


1 Answers

MemoryStream has several constructor overloads, none of which require a file.

like image 57
Robert Harvey Avatar answered Sep 20 '22 19:09

Robert Harvey