http_io

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package http_io implements http handlers based on partial input/output primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler implements ranged http requests on top of StreamerAt interface.

func NewHandler

func NewHandler(s StreamerAt, size int64) *Handler

NewHandler initializes and returns http handler for ranged requests using provided StreamerAt as file source and total file size.

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

func (*Handler) WithContentType

func (h *Handler) WithContentType(contentType string) *Handler

WithContentType sets contentType header.

func (*Handler) WithLog

func (h *Handler) WithLog(log *zap.Logger) *Handler

WithLog sets logger of handler.

type StreamerAt

type StreamerAt interface {
	StreamAt(ctx context.Context, skip int64, w io.Writer) error
}

StreamerAt implements streaming with offset.

Jump to

Keyboard shortcuts

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