Skip to content

Commit

Permalink
Merge pull request #1 from benjih/master
Browse files Browse the repository at this point in the history
Add ParseBytes func to Parser
  • Loading branch information
jackwakefield authored Aug 23, 2018
2 parents aa2174f + 4b741b5 commit 84937a6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ func (parser *Parser) Parse(path string) error {
return parser.rt.run(string(contents))
}

// ParseBytes loads a proxy auto-config (PAC) file using the given byte array
func (parser *Parser) ParseBytes(contents []byte) error {
if !parser.initialised {
if err := parser.init(); err != nil {
return err
}
}

return parser.rt.run(string(contents))
}

// ParseUrl downloads and parses a proxy auto-config (PAC) file using the given
// URL returning an error if the file fails to load.
func (parser *Parser) ParseUrl(url string) error {
Expand Down

0 comments on commit 84937a6

Please sign in to comment.