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

file

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 3 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)
	// ReadFile reads the context of a file
	ReadFile = IOE.Eitherize1(os.ReadFile)
	// WriteFile writes a data blob to a file
	WriteFile = func(dstName string, perm os.FileMode) func([]byte) IOE.IOEither[error, []byte] {
		return func(data []byte) IOE.IOEither[error, []byte] {
			return IOE.TryCatchError(func() ([]byte, error) {
				return data, os.WriteFile(dstName, data, perm)
			})
		}
	}
)

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 Write

func Write[W io.WriteCloser, R any](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

Types

This section is empty.

Jump to

Keyboard shortcuts

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