remote

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 18 Imported by: 0

README

remote

remote is a package for opening remote files easily.

Support remote source

HTTP
f, _ := remote.Open("http://example.com/file.txt")
defer f.Close()
GitHub
f, _, := remote.Open("github://k1LoW/tbls/README.md")
defer f.Close()
Amazon S3
f, _, := remote.Open("s3://my-bucket/path/to/file.txt")
defer f.Close()
Google Cloud Storage
f, _, := remote.Open("gs://my-bucket/path/to/file.txt")
defer f.Close()
f, _, := remote.Open("gcs://my-bucket/path/to/file.txt")
defer f.Close()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(raw string, opts ...Option) (io.ReadCloser, error)

Open remote file.

func ReadAll

func ReadAll(raw string) ([]byte, error)

ReadAll remote file.

Types

type Option

type Option func(*clientSet)

func GCSClient

func GCSClient(c *storage.Client) Option

GCSClient set storage.Client.

func GitHubClient

func GitHubClient(c *github.Client) Option

GitHubClient set github.Client.

func HTTPClient

func HTTPClient(c *http.Client) Option

HTTPClient set http.Client.

func S3Client

func S3Client(c s3iface.S3API) Option

S3Client set github.Client.

Jump to

Keyboard shortcuts

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