Skip to content

Instantly share code, notes, and snippets.

@csmith0651
Created May 25, 2016 12:49
Show Gist options
  • Save csmith0651/8bd56b8327bb730b78bac5d7cafdb77f to your computer and use it in GitHub Desktop.
Save csmith0651/8bd56b8327bb730b78bac5d7cafdb77f to your computer and use it in GitHub Desktop.
type fileFetcher struct {
data []byte
file string
}
func NewFileFetcher(filename string) (S3Fetcher, error) {
// read contents of file
jsonBuff, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
// Create a S3Fetcher object and inject the jsonBuff inside a reader regardless of what S3 object is requested
ret := &fileFetcher{
data: jsonBuff,
file: filename,
}
return ret, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment