urlreader

package module
v0.0.0-...-3f80aa3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2017 License: MIT Imports: 11 Imported by: 2

README

urlreader

Single function that support opening file, https, and s3 URLs. It returns io.ReadCloser:

	import "github.com/agilebits/urlreader"

	...

	// url := "https://twitter.com/1Password"
	url := "file://./main.go"

	reader, err := urlreader.Open(url)
	if err != nil {
		panic(err)
	}

	defer reader.Close()
	result, err := ioutil.ReadAll(reader)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(result))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(url string) (io.ReadCloser, error)

Open https, s3, or file URLs. If the url value does not begin with a scheme then function will try to open a local file. S3 is accessed using environmnent credentials or EC2 role if available.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL