stat

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJsonGnu = `` /* 136-byte string literal not displayed */
)
View Source
const (
	// FormatTerseGnu
	FormatTerseGnu = `%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMode

type FileMode uint16

FileMode is a Linux file mode

const (
	// ModeType is the mask for the type bits
	ModeType = 0o170000

	ModeSocket      FileMode = 0o140000 // socket
	ModeSymlink     FileMode = 0o120000 // symbolic link
	ModeRegularFile FileMode = 0o100000 // regular file
	ModeBlockDevice FileMode = 0o060000 // block device
	ModeDirectory   FileMode = 0o040000 // directory
	ModeCharDevice  FileMode = 0o020000 // character device
	ModeNamedPipe   FileMode = 0o010000 // FIFO
	ModeSetuid      FileMode = 0o004000 // set UID bit
	ModeSetgid      FileMode = 0o002000 // set-group-ID bit
	ModeStick       FileMode = 0o001000 // sticky bit

	// ModePerm is the mask for the permission bits
	ModePerm FileMode = 0o777 // Unix permission bits
)

func (FileMode) IsDir

func (m FileMode) IsDir() bool

func (FileMode) IsRegular

func (m FileMode) IsRegular() bool
func (m FileMode) IsSymlink() bool

func (FileMode) Perm

func (m FileMode) Perm() FileMode

func (FileMode) ToFsFileMode

func (m FileMode) ToFsFileMode() fs.FileMode

ToFsFileMode returns the equivalent fs.FileMode of a stat.FileMode.

type ParseError

type ParseError struct {
	// contains filtered or unexported fields
}

func (*ParseError) Error

func (p *ParseError) Error() string

type Stat

type Stat struct {
	Platform     string
	Mode         FileMode
	Name         string
	Target       string
	User         string
	Uid          int
	Group        string
	Gid          int
	Size         int64
	AccessTime   time.Time
	ModifiedTime time.Time
	ChangeTime   time.Time
}

func ParseJsonFormat

func ParseJsonFormat(data []byte) (*Stat, error)

ParseJsonFormat parsed the provided output of `stat` which is formatted using FormatJsonGnu.

func ParseTerseFormat

func ParseTerseFormat(data []byte) (*Stat, error)

func (*Stat) ToFsFileInfo

func (s *Stat) ToFsFileInfo() fs.FileInfo

ToFsFileInfo returns the Stat as a fs.FileInfo

Jump to

Keyboard shortcuts

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