3

I'm using Azure with blob storage ans Azure Functions. I got a lot of files and sometimes I want to generate a zip, save it in the storage and generate a link.

As my zip can be big (1 or 2 Go) I would like to do this "on the fly", meaning without using all the memory before save it:

stream on a zipentry
write to the blob
flush the stream
create next zipentry

I know I must use the method PutBlock() in the container, but I'm missing the code between ICSharpZipLib and BlobContainer.

Has someone an idea about it ?

2
  • This case may be helpful to you:stackoverflow.com/questions/18852389/… Commented Oct 6, 2017 at 8:36
  • Thanks. I'd seen this question, but I was hoping some other technique exists like writing in a zip stream would write a blob stream (don't know if i'm clear with the concept) Commented Oct 9, 2017 at 7:38

1 Answer 1

4

Well, if I look more attentively at the documentation, I would have seen the method

blob.OpenWrite()

which returns a stream :

using (ZipOutputStream zipStream = new ZipOutputStream(blob.OpenWrite()))

Then I did as usual.

Sign up to request clarification or add additional context in comments.

1 Comment

Are you able to post all the code? Struggling with an implementation at the moment but I'm already using blob write steam as input to zip output stream

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.