Skip to content

Commit

Permalink
Merge pull request #59 from miracl/load-from-pipes
Browse files Browse the repository at this point in the history
fixes #58 Cant read from pipes
  • Loading branch information
andy-miracl committed Apr 13, 2018
2 parents 0ade332 + ae6a9b3 commit 9c3cad8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions loader.go
Expand Up @@ -95,6 +95,13 @@ func (l *loader) wrapFiledatas(bytes ...[]byte) (filedatas, error) {
}

func loadURL(url pkgurl.URL) ([]byte, error) {
if url.Scheme == "file" {
// attempt to load locally handling case where we are loading from fifo etc
b, err := ioutil.ReadFile(url.Path)
if err == nil {
return b, nil
}
}
client := http.Client{Transport: newTransport()}
resp, err := client.Get(url.String())
if err != nil {
Expand Down

0 comments on commit 9c3cad8

Please sign in to comment.