Notifications
Clear all
[Closed] Compress to GZip?
Aug 08, 2019 8:28 am
I am trying to compress a file with Gzip type,the codes here:
file_a=@"C:\file_to_compress.txt"
file_b=@"C:\need_compress.gz"
OriginFile = (dotnetClass "System.IO.File").open file_a (dotnetClass "system.io.filemode").open
CompressedStream = (dotnetClass "System.IO.File").create file_b
OriginStream = dotnetobject "System.IO.Compression.GZipStream" OriginFile (dotnetclass "System.IO.Compression.Compressionmode").compress
OriginStream.CopyTo(CompressedStream)
OriginFile.Close()
CompressedStream.Close()
Then,I got an error:
– Runtime error: dotNet runtime exception: Stream does not support reading. <<
Any one can help me how to fix it?Thanks !