I want to use Go to read out a chunk from a file, treat it as a string
and gzip
this chunk. I know how to read from the file and treat it as a string
, but when it comes to compress/gzip
I am lost.
Should I create an io.writer
, which writes to a buf
(byte slice), use gzip.NewWriter(io.writer)
to get a w *gzip.Writer
and then use w.Write(chunk_of_file)
to write the chunk of file to buf
? Then I would need to treat the string as a byte slice.