io

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

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

func NewArchive

func NewArchive(workingDirectory string) *Archive

func NewArchiveWithStructs

func NewArchiveWithStructs(workingDirectory string, fs IFileSystem, zip IZip) *Archive

func (*Archive) B64

func (arc *Archive) B64(sourceName string, targetName string) error

func (*Archive) Cleanup

func (arc *Archive) Cleanup(fileName string) error

func (*Archive) ZipFile

func (arc *Archive) ZipFile(sourcePath string, targetPath string, zippedName string) error

type FileSystem

type FileSystem struct{}

func (FileSystem) CloseFile

func (_ FileSystem) CloseFile(file *os.File)

func (FileSystem) Create

func (_ FileSystem) Create(path string) (*os.File, error)

func (FileSystem) FsCloseFile

func (_ FileSystem) FsCloseFile(file fs.File)

func (FileSystem) FsOpenEmbed

func (_ FileSystem) FsOpenEmbed(file embed.FS, path string) (fs.File, error)

func (FileSystem) FsReadAll

func (_ FileSystem) FsReadAll(file fs.File) ([]byte, error)

func (FileSystem) FsWriteFile

func (_ FileSystem) FsWriteFile(path string, bytes []byte, perm fs.FileMode) error

func (FileSystem) IsNotExist

func (_ FileSystem) IsNotExist(err error) bool

func (FileSystem) MkdirTemp

func (_ FileSystem) MkdirTemp(pattern string) (string, error)

func (FileSystem) Open

func (_ FileSystem) Open(path string) (*os.File, error)

func (FileSystem) ReadFile

func (_ FileSystem) ReadFile(path string) ([]byte, error)

func (FileSystem) Remove

func (_ FileSystem) Remove(path string) error

func (FileSystem) RemoveAll

func (_ FileSystem) RemoveAll(path string)

func (FileSystem) Stat

func (_ FileSystem) Stat(path string) (os.FileInfo, error)

func (FileSystem) StatFile

func (_ FileSystem) StatFile(file *os.File) (os.FileInfo, error)

func (FileSystem) WriteToWriter

func (_ FileSystem) WriteToWriter(writer io.Writer, content []byte) (int, error)

type FileWriter

type FileWriter struct{}

func (FileWriter) Close

func (fw FileWriter) Close(file *os.File) error

func (FileWriter) Create

func (fw FileWriter) Create(name string) (*os.File, error)

func (FileWriter) Write

func (fw FileWriter) Write(file *os.File, p []byte) error

type IArchive

type IArchive interface {
	ZipFile(sourcePath string, targetPath string, zippedName string) error
	B64(sourceName string, targetName string) error
	Cleanup(targetName string) error
}

type IFileSystem

type IFileSystem interface {
	Open(path string) (*os.File, error)
	Create(path string) (*os.File, error)
	Stat(path string) (os.FileInfo, error)
	ReadFile(path string) ([]byte, error)
	Remove(path string) error
	StatFile(file *os.File) (os.FileInfo, error)
	IsNotExist(err error) bool
	CloseFile(file *os.File)
	WriteToWriter(writer io.Writer, content []byte) (int, error)
	MkdirTemp(pattern string) (string, error)
	RemoveAll(path string)
	FsOpenEmbed(file embed.FS, path string) (fs.File, error)
	FsCloseFile(file fs.File)
	FsReadAll(file fs.File) ([]byte, error)
	FsWriteFile(path string, bytes []byte, perm fs.FileMode) error
}

type IFileWriter

type IFileWriter interface {
	Write(file *os.File, p []byte) error
	Create(name string) (*os.File, error)
	Close(file *os.File) error
}

type IZip

type IZip interface {
	NewWriter(file *os.File) *zip.Writer
	FileInfoHeader(fileInfo fs.FileInfo) (*zip.FileHeader, error)
	GetDeflate() uint16
	CreateHeader(writer *zip.Writer, header *zip.FileHeader) (io.Writer, error)
	Close(writer *zip.Writer) error
}

type Zip

type Zip struct{}

func (Zip) Close

func (z Zip) Close(writer *zip.Writer) error

func (Zip) CreateHeader

func (z Zip) CreateHeader(writer *zip.Writer, header *zip.FileHeader) (io.Writer, error)

func (Zip) FileInfoHeader

func (_ Zip) FileInfoHeader(fileInfo fs.FileInfo) (*zip.FileHeader, error)

func (Zip) GetDeflate

func (_ Zip) GetDeflate() uint16

func (Zip) NewWriter

func (_ Zip) NewWriter(file *os.File) *zip.Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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