2021-05-08 00:59:42 +00:00
|
|
|
// Package unzip defines the Unzipper which fetches and extract a zip file
|
|
|
|
|
// containing multiple files.
|
|
|
|
|
package unzip
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
2021-05-31 00:11:16 +00:00
|
|
|
//go:generate mockgen -destination=mock_$GOPACKAGE/$GOFILE . Unzipper
|
|
|
|
|
|
2021-05-08 00:59:42 +00:00
|
|
|
type Unzipper interface {
|
|
|
|
|
FetchAndExtract(ctx context.Context, url string) (contents map[string][]byte, err error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type unzipper struct {
|
|
|
|
|
client *http.Client
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func New(client *http.Client) Unzipper {
|
|
|
|
|
return &unzipper{
|
|
|
|
|
client: client,
|
|
|
|
|
}
|
|
|
|
|
}
|