public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Data();

            //ExStart: CompressFile
            using (GzipArchive archive = new GzipArchive())
            {
                archive.SetSource(dataDir + "data.bin");
                archive.Save(dataDir + "archive.gz");
            }
            //ExEnd: CompressFile
            Console.WriteLine("Successfully Compressed a File");
        }
Пример #2
0
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Data();

            //ExStart: SaveToStream
            //Writes compressed data to http response stream.
            var ms = new MemoryStream();

            using (var archive = new GzipArchive())
            {
                archive.SetSource(new FileInfo(dataDir + "data.bin"));
                archive.Save(ms);
            }
            //ExEnd: SaveToStream
            Console.WriteLine("Successfully Saved to Stream");
        }