ifs

package
v4.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 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 IsOS

func IsOS(f FS) bool

IsOS returns true if the provided FS implementation is a wrapper around OS access obtained via OS().

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