archive

package
v0.0.0-...-8b65fed Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DaemonName string = "archive"

Variables

View Source
var ArchiveFactories = map[string]vfs.FsFactory{
	".zip": func(ctx context.Context, sourcePath string, f vfs.File) (vfs.Filesystem, error) {
		stat, err := f.Info()
		if err != nil {
			return nil, err
		}
		return NewArchive(ctx, sourcePath, stat.Name(), f, stat.Size(), ZipLoader)
	},
	".rar": func(ctx context.Context, sourcePath string, f vfs.File) (vfs.Filesystem, error) {
		stat, err := f.Info()
		if err != nil {
			return nil, err
		}
		return NewArchive(ctx, sourcePath, stat.Name(), f, stat.Size(), RarLoader)
	},
	".7z": func(ctx context.Context, sourcePath string, f vfs.File) (vfs.Filesystem, error) {
		stat, err := f.Info()
		if err != nil {
			return nil, err
		}
		return NewArchive(ctx, sourcePath, stat.Name(), f, stat.Size(), SevenZipLoader)
	},
}

Functions

func NewDaemon

func NewDaemon(ctx context.Context, koanf *koanf.Koanf) (daemon.Daemon, error)

func RarLoader

func RarLoader(ctx context.Context, archivePath string, f vfs.File, size int64) (map[string]fileEntry, error)

func SevenZipLoader

func SevenZipLoader(ctx context.Context, archivePath string, ctxreader vfs.File, size int64) (map[string]fileEntry, error)

func ZipLoader

func ZipLoader(ctx context.Context, archivePath string, f vfs.File, size int64) (map[string]fileEntry, error)

Types

type ArchiveFS

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

func NewArchive

func NewArchive(ctx context.Context, archivePath, name string, f vfs.File, size int64, loader archiveLoader) (*ArchiveFS, error)

func (*ArchiveFS) FsName

func (a *ArchiveFS) FsName() string

FsName implements Filesystem.

func (*ArchiveFS) Info

func (a *ArchiveFS) Info() (fs.FileInfo, error)

Info implements Filesystem.

func (*ArchiveFS) IsDir

func (a *ArchiveFS) IsDir() bool

IsDir implements Filesystem.

func (*ArchiveFS) ModTime

func (a *ArchiveFS) ModTime() time.Time

ModTime implements Filesystem.

func (*ArchiveFS) Mode

func (a *ArchiveFS) Mode() fs.FileMode

Mode implements Filesystem.

func (*ArchiveFS) Name

func (a *ArchiveFS) Name() string

Name implements Filesystem.

func (*ArchiveFS) Open

func (a *ArchiveFS) Open(ctx context.Context, filename string) (vfs.File, error)

func (*ArchiveFS) ReadDir

func (a *ArchiveFS) ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error)

func (*ArchiveFS) Rename

func (a *ArchiveFS) Rename(ctx context.Context, oldpath string, newpath string) error

Rename implements Filesystem.

func (*ArchiveFS) Size

func (a *ArchiveFS) Size() int64

Size implements Filesystem.

func (*ArchiveFS) Stat

func (afs *ArchiveFS) Stat(ctx context.Context, filename string) (fs.FileInfo, error)

Stat implements Filesystem.

func (*ArchiveFS) Sys

func (a *ArchiveFS) Sys() any

Sys implements Filesystem.

func (*ArchiveFS) Type

func (a *ArchiveFS) Type() fs.FileMode

Type implements Filesystem.

func (a *ArchiveFS) Unlink(ctx context.Context, filename string) error

Unlink implements Filesystem.

type Daemon

type Daemon struct{}

func (*Daemon) Close

func (d *Daemon) Close(ctx context.Context) error

Close implements daemon.Daemon.

func (*Daemon) Extensions

func (d *Daemon) Extensions() []string

Extensions implements daemon.Daemon.

func (*Daemon) GetFS

func (d *Daemon) GetFS(ctx context.Context, sourcePath string, file vfs.File) (vfs.Filesystem, error)

GetFS implements daemon.Daemon.

func (*Daemon) Name

func (d *Daemon) Name() string

Name implements daemon.Daemon.

Jump to

Keyboard shortcuts

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