stat

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

README

stat

Portable command-line utility that displays detailed information about given files including nanosecond resolution for file timestamp fields.

build workflow

Examples

File Storage
./bin/stat-darwin-arm64 go.*
name: /Users/sb/stat/go.mod
device: 16777233
mode: -rw-r--r--
user: sb
group: staff
size: 1721
aTime: "2022-10-15T10:51:29.330700669-03:00"
mTime: "2022-10-15T10:51:22.216926407-03:00"
cTime: "2022-10-15T10:51:22.216926407-03:00"
bTime: "2022-10-15T07:24:15.466480847-03:00"
blocks: 8
blockSize: 4096
flags: 0
---
name: /Users/sb/stat/go.sum
device: 16777233
mode: -rw-r--r--
user: sb
group: staff
size: 6666
aTime: "2022-10-15T10:51:29.331089282-03:00"
mTime: "2022-10-15T10:51:22.216331301-03:00"
cTime: "2022-10-15T10:51:22.216331301-03:00"
bTime: "2022-03-16T20:17:00.892278002-03:00"
blocks: 16
blockSize: 4096
flags: 0
S3 Storage
./bin/stat-darwin-arm64 -o json -s s3 https://s3.amazonaws.com/mybucket/myobject
{
  "name": "https://s3.amazonaws.com/mybucket/myobject",
  "device": 0,
  "mode": "----------",
  "user": "",
  "group": "",
  "size": 804,
  "aTime": "0001-01-01T00:00:00.000000000Z",
  "mTime": "2022-10-15T11:05:25.000000000Z",
  "cTime": "0001-01-01T00:00:00.000000000Z",
  "bTime": "0001-01-01T00:00:00.000000000Z",
  "blocks": 0,
  "blockSize": 0,
  "flags": 0,
  "metadata": {
    "hello": "world"
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStat added in v1.1.0

type FileStat struct{}

func NewFileStat added in v1.1.0

func NewFileStat() *FileStat

func (*FileStat) Stat added in v1.1.0

func (fs *FileStat) Stat(name string) (*StatInfo, error)

type S3Stat added in v1.1.0

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

func NewS3Stat added in v1.1.0

func NewS3Stat(client *http.Client) *S3Stat

func (*S3Stat) Stat added in v1.1.0

func (ss *S3Stat) Stat(name string) (*StatInfo, error)

type StatInfo added in v1.1.0

type StatInfo struct {
	Name      string            `csv:"name"               json:"name"               yaml:"name"`
	Device    uint64            `csv:"device"             json:"device"             yaml:"device"`
	Mode      os.FileMode       `csv:"mode"               json:"mode"               yaml:"mode"`
	User      string            `csv:"user"               json:"user"               yaml:"user"`
	Group     string            `csv:"group"              json:"group"              yaml:"group"`
	Size      int64             `csv:"size"               json:"size"               yaml:"size"`
	Atime     time.Time         `csv:"aTime"              json:"aTime"              yaml:"aTime"`
	Mtime     time.Time         `csv:"mTime"              json:"mTime"              yaml:"mTime"`
	Ctime     time.Time         `csv:"cTime"              json:"cTime"              yaml:"cTime"`
	Btime     time.Time         `csv:"bTime"              json:"bTime"              yaml:"bTime"`
	Blocks    int64             `csv:"blocks"             json:"blocks"             yaml:"blocks"`
	BlockSize int32             `csv:"blockSize"          json:"blockSize"          yaml:"blockSize"`
	Flags     uint32            `csv:"flags"              json:"flags"              yaml:"flags"`
	Metadata  map[string]string `csv:"metadata,omitempty" json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Error     error             `csv:"error,omitempty"    json:"error,omitempty"    yaml:"error,omitempty"`
}

func (*StatInfo) Pretty added in v1.1.0

func (si *StatInfo) Pretty(dateLayout string) *StatInfoPretty

type StatInfoPretty added in v1.1.0

type StatInfoPretty struct {
	Name      string            `csv:"name"               json:"name"               yaml:"name"`
	Device    uint64            `csv:"device"             json:"device"             yaml:"device"`
	Mode      string            `csv:"mode"               json:"mode"               yaml:"mode"`
	User      string            `csv:"user"               json:"user"               yaml:"user"`
	Group     string            `csv:"group"              json:"group"              yaml:"group"`
	Size      int64             `csv:"size"               json:"size"               yaml:"size"`
	Atime     string            `csv:"aTime"              json:"aTime"              yaml:"aTime"`
	Mtime     string            `csv:"mTime"              json:"mTime"              yaml:"mTime"`
	Ctime     string            `csv:"cTime"              json:"cTime"              yaml:"cTime"`
	Btime     string            `csv:"bTime"              json:"bTime"              yaml:"bTime"`
	Blocks    int64             `csv:"blocks"             json:"blocks"             yaml:"blocks"`
	BlockSize int32             `csv:"blockSize"          json:"blockSize"          yaml:"blockSize"`
	Flags     uint32            `csv:"flags"              json:"flags"              yaml:"flags"`
	Metadata  map[string]string `csv:"metadata,omitempty" json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Error     string            `csv:"error"              json:"error,omitempty"    yaml:"error,omitempty"`
}

Directories

Path Synopsis
cmd
app
internal

Jump to

Keyboard shortcuts

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