Help us shape the future of Go! Take the 2026 Go Developer Survey

file

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

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 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