0

I'm using the Iconic Zip Library to do some zipping.

When it's time to zip up, I want to call their ZipFile.Save(Stream outputStream) method.

On the Telligent side, to save the content of a stream to a file you use their ICentralizedFileStorageProvider.AddUpdateFile(string path, string fileName, Stream contentStream) method.

As you can see, you provide the Iconic Zip Library a stream for them to write to, but to save a file, Telligent does not provide you with a stream for you to write to, you need to provide them with a stream for them to read from.

Sure, I could use a MemoryStream, load it by passing it the Iconic Zip Library and then unload it by passing it to the Telligent APIs, but that would cause the entire zip file to be loaded to memory all at once. I know that the final zip is going to be huge, so loading it entirely onto memory is not an option; I need to do some sort of buffering.

How do I reconcile these two APIs? How do I build a bridge between them where data can flow without hogging up memory? Any ideas?

AxiomaticNexus
  • 6,190
  • 3
  • 41
  • 61
  • Since neither API you referenced is async, there may not be anything you can do. – Eris Jun 17 '16 at 21:44
  • You could write a "SynchronizedStream" class that uses a mutex to synchronize between different instances, so the Read and Write methods will wait for the current operation to finish before starting a new one. – doomgg Jun 17 '16 at 21:52
  • @bob1024 Any tutorials on how to pull this off? – AxiomaticNexus Jun 17 '16 at 21:56
  • Finally, I'm not sure my solution is what you're looking for. Can you provide the code where you are stuck because I think I'm missing something. – doomgg Jun 17 '16 at 22:50

0 Answers0