mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
54 lines
951 B
Go
54 lines
951 B
Go
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
// Package fileinfo provides virtual os.FileInfo for given information.
|
|
package fileinfo
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
type Info struct {
|
|
name string
|
|
size int64
|
|
mode os.FileMode
|
|
modTime time.Time
|
|
}
|
|
|
|
func New(name string, size int64, mode os.FileMode, modTime time.Time) *Info {
|
|
return &Info{
|
|
name: name,
|
|
size: size,
|
|
mode: mode,
|
|
modTime: modTime,
|
|
}
|
|
}
|
|
|
|
func (i *Info) Name() string {
|
|
return i.name
|
|
}
|
|
|
|
func (i *Info) Size() int64 {
|
|
return i.size
|
|
}
|
|
|
|
func (i *Info) IsDir() bool {
|
|
return i.mode.IsDir()
|
|
}
|
|
|
|
func (i *Info) Mode() os.FileMode {
|
|
return i.mode
|
|
}
|
|
|
|
func (i *Info) ModTime() time.Time {
|
|
return i.modTime
|
|
}
|
|
|
|
func (i *Info) Sys() interface{} {
|
|
return nil
|
|
}
|