httpio

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package httpio provides types for basic I/O interfaces over HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

func WithBasicAuth

func WithBasicAuth(usr, pwd string) Option

WithBasicAuth sets up a basic authentification scheme.

func WithClient

func WithClient(cli *http.Client) Option

WithClient sets up Reader to use a user-provided HTTP client.

By default, Reader uses an httpio-local default client.

func WithContext

func WithContext(ctx context.Context) Option

WithContext configures Reader to use a user-provided context.

By default, Reader uses context.Background.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader presents an HTTP resource as an io.Reader and io.ReaderAt.

func Open

func Open(uri string, opts ...Option) (r *Reader, err error)

Open returns a Reader from the provided URL.

func (*Reader) Close

func (r *Reader) Close() error

Close implements the io.Closer interface.

func (*Reader) Name

func (r *Reader) Name() string

Name returns the name of the file as presented to Open.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements the io.Reader interface.

func (*Reader) ReadAt

func (r *Reader) ReadAt(p []byte, off int64) (int, error)

ReadAt implements the io.ReaderAt interface.

func (*Reader) Seek

func (r *Reader) Seek(offset int64, whence int) (int64, error)

Seek implements the io.Seeker interface.

func (*Reader) Size

func (r *Reader) Size() int64

Size returns the number of bytes available for reading via ReadAt.

Jump to

Keyboard shortcuts

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