I fetch a data from http service and I want to unzip it on the fly. Here is my current approach:
resp, err := http.Get(url)
if err != nil {
logger.Fatalf("Can't fatch %s data. %v", url, err)
}
logger.Info("Fetched data from %s", url)
content_zipped, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
logger.Fatal(err)
}
zip_reader, err := zip.NewReader(bytes.NewReader(content_zipped), int64(len(content_zipped)))
Is there any way to unzip the resp.Body without reading all the content at once (6. line)? I mean to stream the bytes.