-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfs.go
40 lines (31 loc) · 815 Bytes
/
fs.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
package logger
import (
"io"
"os"
)
var fileSys StandardFileSystem
type (
FileSystem interface {
Close(closer io.Closer) error
Copy(writer io.Writer, reader io.Reader) (int64, error)
Create(name string) (*os.File, error)
Open(name string) (*os.File, error)
Remove(name string) error
}
StandardFileSystem struct{}
)
func (fs StandardFileSystem) Close(closer io.Closer) error {
return closer.Close()
}
func (fs StandardFileSystem) Copy(writer io.Writer, reader io.Reader) (int64, error) {
return io.Copy(writer, reader)
}
func (fs StandardFileSystem) Create(name string) (*os.File, error) {
return os.Create(name)
}
func (fs StandardFileSystem) Open(name string) (*os.File, error) {
return os.Open(name)
}
func (fs StandardFileSystem) Remove(name string) error {
return os.Remove(name)
}