fs

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFactories = map[string]FsFactory{
	".zip": func(f File) (Filesystem, error) {
		return NewArchive(f, f.Size(), &Zip{}), nil
	},
	".rar": func(f File) (Filesystem, error) {
		return NewArchive(f, f.Size(), &Rar{}), nil
	},
	".7z": func(f File) (Filesystem, error) {
		return NewArchive(f, f.Size(), &SevenZip{}), nil
	},
}

Functions

func NewArchive

func NewArchive(r iio.Reader, size int64, l loader) *archive

func NewFileInfo

func NewFileInfo(name string, size int64, isDir bool) *fileInfo

Types

type ArchiveFile

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

func NewArchiveFile

func NewArchiveFile(readerFunc func() (iio.Reader, error), len int64) *ArchiveFile

func (*ArchiveFile) Close

func (d *ArchiveFile) Close() (err error)

func (*ArchiveFile) IsDir

func (d *ArchiveFile) IsDir() bool

func (*ArchiveFile) Read

func (d *ArchiveFile) Read(p []byte) (n int, err error)

func (*ArchiveFile) ReadAt

func (d *ArchiveFile) ReadAt(p []byte, off int64) (n int, err error)

func (*ArchiveFile) Size

func (d *ArchiveFile) Size() int64

type ContainerFs

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

func NewContainerFs

func NewContainerFs(fss map[string]Filesystem) (*ContainerFs, error)

func (*ContainerFs) Open

func (fs *ContainerFs) Open(filename string) (File, error)

func (*ContainerFs) ReadDir

func (fs *ContainerFs) ReadDir(path string) (map[string]File, error)

type Dir

type Dir struct {
}

func (*Dir) Close

func (d *Dir) Close() error

func (*Dir) IsDir

func (d *Dir) IsDir() bool

func (*Dir) Read

func (d *Dir) Read(p []byte) (n int, err error)

func (*Dir) ReadAt

func (d *Dir) ReadAt(p []byte, off int64) (n int, err error)

func (*Dir) Size

func (d *Dir) Size() int64

type File

type File interface {
	IsDir() bool
	Size() int64

	iio.Reader
}

type Filesystem

type Filesystem interface {
	// Open opens the named file for reading. If successful, methods on the
	// returned file can be used for reading; the associated file descriptor has
	// mode O_RDONLY.
	Open(filename string) (File, error)

	// ReadDir reads the directory named by dirname and returns a list of
	// directory entries.
	ReadDir(path string) (map[string]File, error)
}

type FsFactory

type FsFactory func(f File) (Filesystem, error)

type Memory

type Memory struct {
	Storage *storage
}

func NewMemory

func NewMemory() *Memory

func (*Memory) Open

func (fs *Memory) Open(filename string) (File, error)

func (*Memory) ReadDir

func (fs *Memory) ReadDir(path string) (map[string]File, error)

type MemoryFile

type MemoryFile struct {
	*bytes.Reader
}

func NewMemoryFile

func NewMemoryFile(data []byte) *MemoryFile

func (*MemoryFile) Close

func (d *MemoryFile) Close() (err error)

func (*MemoryFile) IsDir

func (d *MemoryFile) IsDir() bool

func (*MemoryFile) Size

func (d *MemoryFile) Size() int64

type Rar

type Rar struct {
}

type SevenZip

type SevenZip struct {
}

type Torrent

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

func NewTorrent

func NewTorrent(readTimeout int) *Torrent

func (*Torrent) AddTorrent

func (fs *Torrent) AddTorrent(t *torrent.Torrent)

func (*Torrent) Open

func (fs *Torrent) Open(filename string) (File, error)

func (*Torrent) ReadDir

func (fs *Torrent) ReadDir(path string) (map[string]File, error)

func (*Torrent) RemoveTorrent

func (fs *Torrent) RemoveTorrent(h string)

type Zip

type Zip struct {
}

Jump to

Keyboard shortcuts

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