os

package
v1.454.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const ModeAppend = os.ModeAppend

ModeAppend will append to an existing file.

Variables

View Source
var Args = os.Args

Args is an alias for os.Args.

View Source
var Exit = os.Exit

Exit is just an alias to os.Exit.

View Source
var Module = fx.Options(
	fx.Provide(NewFS),
)

Module for fx.

Functions

func ExecutableName

func ExecutableName() string

ExecutableName of the running application.

func GetVariable added in v1.421.0

func GetVariable(key string) string

GetVariable by key.

func IsNotExist added in v1.386.0

func IsNotExist(err error) bool

IsNotExist if the error is os.ErrNotExist.

func PathExists added in v1.386.0

func PathExists(path string) bool

PathExists for the path provided.

func PathExtension added in v1.420.0

func PathExtension(path string) string

PathExtension of the specified path.

func ReadFile added in v1.195.0

func ReadFile(path string) (string, error)

ReadFile for the path provided.

func Remove added in v1.423.0

func Remove(name string) error

Remove a file or empty folder.

func SetVariable added in v1.421.0

func SetVariable(key, value string) error

SetVariable of value by key.

func UnsetVariable added in v1.423.0

func UnsetVariable(key string) error

UnsetVariable by key.

func WriteFile added in v1.421.0

func WriteFile(name string, data string, perm FileMode) error

WriteFile writes data to name with perm.

Types

type FileMode added in v1.421.0

type FileMode = os.FileMode

FileMode is an alias to os.FileMode.

type FileSystem added in v1.375.0

type FileSystem interface {
	// ReadFile for the path provided.
	ReadFile(path string) (string, error)

	// WriteFile writes data to name.
	WriteFile(name string, data string, perm FileMode) error

	// PathExists for the path provided.
	PathExists(path string) bool

	// IsNotExist whether the error is os.ErrNotExist.
	IsNotExist(err error) bool
}

FileSystem borrows concepts from io/fs.

func NewFS added in v1.375.0

func NewFS() FileSystem

NewFS for os.

type SystemFS added in v1.421.0

type SystemFS struct{}

SystemFS uses the underlying os.

func (*SystemFS) IsNotExist added in v1.421.0

func (*SystemFS) IsNotExist(err error) bool

IsNotExist for os.

func (*SystemFS) PathExists added in v1.421.0

func (*SystemFS) PathExists(name string) bool

PathExists for os.

func (*SystemFS) ReadFile added in v1.421.0

func (*SystemFS) ReadFile(path string) (string, error)

ReadFile for os.

func (*SystemFS) WriteFile added in v1.421.0

func (*SystemFS) WriteFile(name string, data string, perm FileMode) error

WriteFile for os.

Jump to

Keyboard shortcuts

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