package httpio

import "go-hep.org/x/hep/groot/internal/httpio"

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

Index

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.

Source Files

httpio.go reader.go

Version
v0.36.0 (latest)
Published
Nov 15, 2024
Platform
linux/amd64
Imports
8 packages
Last checked
2 days ago

Tools for package owners.