ioeither

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// UnmarshalFromStdIn loads a tar file from stdin
	UnmarshalFromStdIn = Unmarshal(onGetStdIn)

	// UnmarshalFromInput loads a tar file into a file list from either a file or stdin (using "-" as the stdin identifier)
	UnmarshalFromInput = F.Flow2(
		CF.IsNotStdinNorStdout,
		O.Fold(F.Constant(UnmarshalFromStdIn), UnmarshalFromFile),
	)

	// UnmarshalFromFile loads a tar file into a file list
	UnmarshalFromFile = F.Flow2(
		IOEF.Open,
		Unmarshal[*os.File],
	)

	// MarshalToStdOut stores a a tar file to stdout
	MarshalToStdOut = Marshal(onGetStdOut)

	// MarshalToFile stores a file list to a file in tar format
	MarshalToFile = F.Flow2(
		IOEF.Create,
		Marshal[*os.File],
	)

	// MarshalToInput stores a file list either to a tar file or stdout (using "-" as the stdout identifier)
	MarshalToOutput = F.Flow2(
		CF.IsNotStdinNorStdout,
		O.Fold(F.Constant(MarshalToStdOut), MarshalToFile),
	)
)

Functions

func ExtractToFolder

func ExtractToFolder(dstFolder string, perm os.FileMode) func(T.FileList) IOE.IOEither[error, T.FileList]

ExtractToFolder extracts the file list to the file system in the given folder

func FromFolder

func FromFolder(folder string) IOE.IOEither[error, T.FileList]

FromFolder reads the content of the given filder into a file list

func Marshal

func Marshal[W io.WriteCloser](acquire IOE.IOEither[error, W]) func(T.FileList) IOE.IOEither[error, []byte]

Marshal serializes a [T.FileList] as a tar file onto a io.WriteCloser

func Unmarshal

func Unmarshal[R io.ReadCloser](acquire IOE.IOEither[error, R]) IOE.IOEither[error, T.FileList]

Unmarshal parses the content of a reader of a tar file into an in-memory copy

func WalkFolder

func WalkFolder[T any](read func(string) T) func(fs.FS) IOE.IOEither[error, map[string]T]

WalkFolder walks the files in the file system

Types

This section is empty.

Jump to

Keyboard shortcuts

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