archive

package
v4.2.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const UnCompressThreshold = int64(100)

Variables

This section is empty.

Functions

func WithArchives

func WithArchives() nodes.Option

Types

type Handler

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

Handler dynamically create archives when downloading folders and supports archive contents listing.

func NewArchiveHandler

func NewArchiveHandler() *Handler

NewArchiveHandler creates a new Handler

func (*Handler) Adapt

func (a *Handler) Adapt(h nodes.Handler, options nodes.RouterOptions) nodes.Handler

func (*Handler) GetObject

func (a *Handler) GetObject(ctx context.Context, node *tree.Node, requestData *models.GetRequestData) (io.ReadCloser, error)

GetObject overrides the response of GetObject if it is sent on a folder key : create an archive on-the-fly.

func (*Handler) ListNodes

func (*Handler) ReadNode

func (a *Handler) ReadNode(ctx context.Context, in *tree.ReadNodeRequest, opts ...grpc.CallOption) (*tree.ReadNodeResponse, error)

ReadNode overrides the response of ReadNode to create a fake stat for archive file

type Reader

type Reader struct {
	Router nodes.Handler
}

func (*Reader) ExtractAllTar

func (a *Reader) ExtractAllTar(ctx context.Context, gzipFormat bool, archiveNode *tree.Node, targetNode *tree.Node, logChannels ...chan string) error

ExtractAllTar extracts all files contained in a tar/tar.gz archive to a given location

func (*Reader) ExtractAllZip

func (a *Reader) ExtractAllZip(ctx context.Context, archiveNode *tree.Node, targetNode *tree.Node, logChannels ...chan string) error

ExtractAllZip extracts all files contained in a zip archive to a given location

func (*Reader) ListChildrenTar

func (a *Reader) ListChildrenTar(ctx context.Context, gzipFormat bool, archiveNode *tree.Node, parentPath string, stat ...bool) ([]*tree.Node, error)

ListChildrenTar extracts all children from a tar/tar.gz archive

func (*Reader) ListChildrenZip

func (a *Reader) ListChildrenZip(ctx context.Context, archiveNode *tree.Node, parentPath string, stat ...bool) ([]*tree.Node, error)

ListChildrenZip extracts all children from a zip archive

func (*Reader) ReadChildTar

func (a *Reader) ReadChildTar(ctx context.Context, gzipFormat bool, writer io.WriteCloser, archiveNode *tree.Node, innerPath string) (int64, error)

ReadChildTar reads content of a file contained in a tar/tar.gz archive

func (*Reader) ReadChildZip

func (a *Reader) ReadChildZip(ctx context.Context, archiveNode *tree.Node, innerPath string) (io.ReadCloser, error)

ReadChildZip reads content of a file contained in a zip archive

func (*Reader) StatChildTar

func (a *Reader) StatChildTar(ctx context.Context, gzipFormat bool, archiveNode *tree.Node, innerPath string) (*tree.Node, error)

StatChildTar finds information about a given entry of a tar/tar.gz archive (by its internal path)

func (*Reader) StatChildZip

func (a *Reader) StatChildZip(ctx context.Context, archiveNode *tree.Node, innerPath string) (*tree.Node, error)

StatChildZip finds information about a given entry of a zip archive (by its internal path)

type Writer

type Writer struct {
	Router nodes.Handler

	// Optional filter when listing nodes to build the archive
	WalkFilter nodes.WalkFilterFunc
}

func (*Writer) TarSelection

func (w *Writer) TarSelection(ctx context.Context, output io.Writer, gzipFile bool, selection []*tree.Node, logsChannel ...chan string) (int64, error)

TarSelection creates a .tar or .tar.gz archive from nodes selection

func (*Writer) ZipSelection

func (w *Writer) ZipSelection(ctx context.Context, output io.Writer, selection []*tree.Node, logsChannels ...chan string) (int64, error)

ZipSelection creates a .zip archive from nodes selection

Jump to

Keyboard shortcuts

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