handlers

package
v3.34.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleFile

func HandleFile(ctx context.Context, file io.Reader, chunkSkel *sources.Chunk, chunksChan chan (*sources.Chunk)) bool

func SetArchiveMaxDepth added in v3.27.0

func SetArchiveMaxDepth(depth int)

SetArchiveMaxDepth sets the maximum depth of the archive.

func SetArchiveMaxSize added in v3.27.0

func SetArchiveMaxSize(size int)

SetArchiveMaxSize sets the maximum size of the archive.

func SetArchiveMaxTimeout added in v3.27.0

func SetArchiveMaxTimeout(timeout time.Duration)

SetArchiveMaxTimeout sets the maximum timeout for the archive handler.

Types

type Archive

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

Archive is a handler for extracting and decompressing archives.

func (*Archive) FromFile

func (d *Archive) FromFile(originalCtx context.Context, data io.Reader) chan ([]byte)

FromFile extracts the files from an archive.

func (*Archive) IsFiletype

func (d *Archive) IsFiletype(ctx context.Context, reader io.Reader) (io.Reader, bool)

IsFiletype returns true if the provided reader is an archive.

func (*Archive) New

func (d *Archive) New()

New sets a default maximum size and current size counter.

func (*Archive) ReadToMax

func (d *Archive) ReadToMax(ctx context.Context, reader io.Reader) (data []byte, err error)

ReadToMax reads up to the max size.

type Handler

type Handler interface {
	FromFile(context.Context, io.Reader) chan ([]byte)
	IsFiletype(context.Context, io.Reader) (io.Reader, bool)
	New()
}

func DefaultHandlers

func DefaultHandlers() []Handler

Jump to

Keyboard shortcuts

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