browser: Index | Examples | Files | Directories

package browser

import ""

Package browser provides helpers to open files, readers, and urls in a browser window.

The choice of which browser is started is entirely client dependant.



Package Files

browser.go browser_linux.go


var Stderr io.Writer = os.Stderr

Stderr is the io.Writer to which executed commands write standard error.

var Stdout io.Writer = os.Stdout

Stdout is the io.Writer to which executed commands write standard output.

func OpenFile Uses

func OpenFile(path string) error

OpenFile opens new browser window for the file path.



func OpenReader Uses

func OpenReader(r io.Reader) error

OpenReader consumes the contents of r and presents the results in a new browser window.


const quote = `There was a night when winds from unknown spaces
whirled us irresistibly into limitless vacum beyond all thought and entity.
Perceptions of the most maddeningly untransmissible sort thronged upon us;
perceptions of infinity which at the time convulsed us with joy, yet which
are now partly lost to my memory and partly incapable of presentation to others.`
r := strings.NewReader(quote)

func OpenURL Uses

func OpenURL(url string) error

OpenURL opens a new browser window pointing to url.


const url = ""


examples/OpenOpen is a simple example of the package.

Package browser imports 6 packages (graph) and is imported by 199 packages. Updated 2020-08-20. Refresh now. Tools for package owners.