-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
fileinfo.go
53 lines (43 loc) · 951 Bytes
/
fileinfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 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
}