I have a DataSet consisting of XML data, I can easily output this to a file:
DataSet ds = new DataSet();
DataTable dt = new DataTable();
ds.Tables.Add(dt);
ds.Load(reader, LoadOption.PreserveChanges, ds.Tables[0]);
ds.WriteXml("C:\\test.xml");
However what I want to do is compress the XML into a ZIP or other type of compressed file and then just save this file to disk while splitting the ZIP file into 1MB chunks. I do not really want to save the uncompressed file, and then zip it, then split it.
What I'm looking for specifically is:
- a suitable compression library that I can stream the XML to and have the zip file(s) saved to disk
- some sample C# code that can show me how to do this.