file

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package file provides convenient helpers for files and abstractions of files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockZipReader

func MockZipReader(files []string) *zip.Reader

func ZipBasePath

func ZipBasePath(zr *zip.Reader) (b string)

Types

type File

type File struct {
	Content io.ReadCloser
	Path    string
	Size    int64
	// If the content type is not explicitly specified, ContenType will be an empty string.
	ContentType string
}

File abstracts an abstract file

type FilteredIterator

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

func NewFilteredIterator

func NewFilteredIterator(a Iterator, skipper func(p string) bool) *FilteredIterator

func (*FilteredIterator) Next

func (s *FilteredIterator) Next() (*File, error)

type FsIterator

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

func NewFsIterator

func NewFsIterator(afs afero.Fs) (*FsIterator, error)

func (*FsIterator) Next

func (a *FsIterator) Next() (*File, error)

type Iterator

type Iterator interface {
	// Next returns the next File. If there is no next File, returns nil file and nil error
	Next() (*File, error)
}

Iterator is an iterator of files

type PrefixIterator

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

func NewPrefixIterator

func NewPrefixIterator(a Iterator, prefix string) *PrefixIterator

func (*PrefixIterator) Next

func (s *PrefixIterator) Next() (*File, error)

type SimpleIterator

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

For debugging

func NewSimpleIterator

func NewSimpleIterator(files []File) *SimpleIterator

func (*SimpleIterator) Next

func (s *SimpleIterator) Next() (*File, error)

type TarReader

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

func NewTarReader

func NewTarReader(tr *tar.Reader) *TarReader

func TarReaderFromTarGz

func TarReaderFromTarGz(r io.Reader) (*TarReader, error)

func (*TarReader) Next

func (r *TarReader) Next() (*File, error)

type ZipReader

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

func NewZipReader

func NewZipReader(zr *zip.Reader) *ZipReader

func ZipReaderFrom

func ZipReaderFrom(r io.Reader, n int64) (*ZipReader, error)

func (*ZipReader) Next

func (r *ZipReader) Next() (*File, error)

Jump to

Keyboard shortcuts

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