I am trying to use gzip package - compress/gzip - Go Packages and it works as expected when used DefaultCompression and I tried using NoCompression and I found similar with default one.
So, what does NoCompression do? I expected it should not compress, but it’s compressing.
Can you share more information about the compression ratio or the file types you are trying to compress?
Are you trying to compress an already compressed file?
In the context of the compress/gzip package in Go, the NoCompression constant is one of the compression levels provided by the package. When you set the compression level to NoCompression, it means that the gzip package will not apply any compression to the data being processed.
By default, the compress/gzip package uses a compression level called DefaultCompression, which provides a balanced trade-off between compression ratio and speed. However, when you specify NoCompression as the compression level, the gzip package will simply store the input data without applying any compression algorithm.
Setting the compression level to NoCompression can be useful in situations where you want to use the gzip package to write or read data in the gzip format, but you don’t want the data to be compressed. This could be applicable when you need to interface with systems or protocols that expect data in the gzip format but don’t require compression.