lazyio

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 6 Imported by: 4

Documentation

Overview

Package lazyio includes io.ReadClosers that will lazily load from a file or URL.

Index

Constants

View Source
const (
	// StdIO can be passed to File to set Stdin as the default
	StdIO = "-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	Read(p []byte) (n int, err error)
	Close() error
	Set(string) error
	Get() any
	String() string
}

Reader is an io.ReadCloser that can be used as a flag.Value.

func File

func File(defaultPath string) Reader

File returns an io.Reader that lazily loads a file set as a flag.Value. Pass StdIO ("-") to read from standard input.

func FileOrURL

func FileOrURL(defaultPath string, client *http.Client) Reader

FileOrURL is an io.Reader that lazily opens a URL or file path set as a flag.Value.

func URL

func URL(defaultPath string, client *http.Client) Reader

URL returns an io.Reader that lazily loads an HTTP(S) URL set as a flag.Value.

Jump to

Keyboard shortcuts

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