os

package
v1.422.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

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 ReadBase64File added in v1.193.0

func ReadBase64File(path string) (string, error)

ReadBase64File for the path provided.

func ReadFile added in v1.195.0

func ReadFile(path string) (string, error)

ReadFile for the path provided.

func SetVariable added in v1.421.0

func SetVariable(key, value string) error

SetVariable of value 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

func (*SystemFS) PathExists added in v1.421.0

func (*SystemFS) PathExists(name string) bool

func (*SystemFS) ReadFile added in v1.421.0

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

func (*SystemFS) WriteFile added in v1.421.0

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

Jump to

Keyboard shortcuts

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