file

package
v1.0.148 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Open opens a file for reading
	Open = IOE.Eitherize1(os.Open)
	// Create opens a file for writing
	Create = IOE.Eitherize1(os.Create)
	// ReadFile reads the context of a file
	ReadFile = IOE.Eitherize1(os.ReadFile)
)
View Source
var (
	// CreateTemp created a temp file with proper parametrization
	CreateTemp = IOE.Eitherize2(os.CreateTemp)
)

Functions

func Close added in v1.0.35

func Close[C io.Closer](c C) IOE.IOEither[error, any]

Close closes an object

func Mkdir added in v1.0.103

func Mkdir(path string, perm os.FileMode) IOE.IOEither[error, string]

Mkdir create a directory, see os.Mkdir

func MkdirAll added in v1.0.103

func MkdirAll(path string, perm os.FileMode) IOE.IOEither[error, string]

MkdirAll create a sequence of directories, see os.MkdirAll

func ReadAll

func ReadAll[R io.ReadCloser](acquire IOE.IOEither[error, R]) IOE.IOEither[error, []byte]

ReadAll uses a generator function to create a stream, reads it and closes it

func Remove added in v1.0.10

func Remove(name string) IOE.IOEither[error, string]

Remove removes a file by name

func WithTempFile added in v1.0.10

func WithTempFile[A any](f func(*os.File) IOE.IOEither[error, A]) IOE.IOEither[error, A]

WithTempFile creates a temporary file, then invokes a callback to create a resource based on the file, then close and remove the temp file

func Write

func Write[R any, W io.WriteCloser](acquire IOE.IOEither[error, W]) func(use func(W) IOE.IOEither[error, R]) IOE.IOEither[error, R]

Write uses a generator function to create a stream, writes data to it and closes it

func WriteAll

func WriteAll[W io.WriteCloser](data []byte) func(acquire IOE.IOEither[error, W]) IOE.IOEither[error, []byte]

WriteAll uses a generator function to create a stream, writes data to it and closes it

func WriteFile

func WriteFile(dstName string, perm os.FileMode) func([]byte) IOE.IOEither[error, []byte]

WriteFile writes a data blob to a file

Types

This section is empty.

Jump to

Keyboard shortcuts

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