github.com/wangyougui/gf/v2@v2.6.5/internal/fileinfo/fileinfo.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/wangyougui/gf. 6 7 // Package fileinfo provides virtual os.FileInfo for given information. 8 package fileinfo 9 10 import ( 11 "os" 12 "time" 13 ) 14 15 type Info struct { 16 name string 17 size int64 18 mode os.FileMode 19 modTime time.Time 20 } 21 22 func New(name string, size int64, mode os.FileMode, modTime time.Time) *Info { 23 return &Info{ 24 name: name, 25 size: size, 26 mode: mode, 27 modTime: modTime, 28 } 29 } 30 31 func (i *Info) Name() string { 32 return i.name 33 } 34 35 func (i *Info) Size() int64 { 36 return i.size 37 } 38 39 func (i *Info) IsDir() bool { 40 return i.mode.IsDir() 41 } 42 43 func (i *Info) Mode() os.FileMode { 44 return i.mode 45 } 46 47 func (i *Info) ModTime() time.Time { 48 return i.modTime 49 } 50 51 func (i *Info) Sys() interface{} { 52 return nil 53 }