ifs

package
v4.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileWrite

func FileWrite(file fs.File, data []byte) (int, error)

FileWrite attempts to write to an fs.File provided it supports io.Writer.

func ReadFile

func ReadFile(f fs.FS, name string) ([]byte, error)

ReadFile opens a file with the RDONLY flag and returns all bytes from it.

func WriteFile

func WriteFile(f fs.FS, name string, data []byte, perm fs.FileMode) error

WriteFile opens a file with O_WRONLY|O_CREATE|O_TRUNC flags and writes the data to it.

Types

type FS

type FS interface {
	Open(name string) (fs.File, error)
	OpenFile(name string, flag int, perm fs.FileMode) (fs.File, error)
	Stat(name string) (fs.FileInfo, error)
	Remove(name string) error
	MkdirAll(path string, perm fs.FileMode) error
}

FS is a superset of fs.FS that includes goodies that benthos components specifically need.

func OS

func OS() FS

OS implements fs.FS as if calls were being made directly via the os package, with which relative paths are resolved from the directory the process is executed from.

Jump to

Keyboard shortcuts

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