0

I have a byte buffer (between 3000 and 50000 bytes) that I would like to send through serial COM from a PC to an µ-controller. As far as this transfer is slow (115200 bytes/s), I would like to compress it in ZIP format in memory before sending it.

I don't want GZIP, as the destination controller can natively uncompress ZIP.

System.IO.Compress.ZipArchive seems to be used for files, but I just want to remain in memory using an input buffer and an output buffer.

How can I do that, please?

Thanks

David

David La
  • 13
  • 4
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jan 17 '23 at 13:03
  • Question has been asked lots of times. See : https://stackoverflow.com/questions/17232414/creating-a-zip-archive-in-memory-using-system-io-compression?force_isolation=true – jdweng Jan 17 '23 at 17:43
  • Hello @jdweng. Sorry if that's a duplicate, thanks. Anyway in the example, the input is a file, not a buffer. I'll continue to search. Thanks again – David La Jan 17 '23 at 17:50
  • To convert a string to a stream use : StingReader stream = new StringReader(string) Then use the stream like in the link. Or use StreamReader stream = new StreamReader(filename); – jdweng Jan 17 '23 at 19:33

0 Answers0