Hey all,
Thanks, the io.copy resolved the issue.
Thanks & Regards
Mukund
On Thu, Feb 16, 2017 at 2:51 AM, Dave Cheney wrote:
> Or use https://godoc.org/io/ioutil#ReadFile
>
> By really you don't need to buffer all the data in memory, io.Copy will do
> that for you
>
> in, err := os.Open(inpu
Or use https://godoc.org/io/ioutil#ReadFile
By really you don't need to buffer all the data in memory, io.Copy will do
that for you
in, err := os.Open(input)
check(err)
defer in.Close()
out, err := os.Create(output)
gz := gzip.New.Writer(out)
_, err = io.Copy(gz, in)
check(err)
err = gz.Close()
While it is not clear from the Buffer documentation, the Reader *interface*
documentation (which Buffer.Read implements implicitly) does state "up to
len(p) bytes." You are ignoring how many bytes it read and assuming that
the one read is reading the whole file. I am not sure that this is
guara