go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/_motor/providers/winrm/cat/cat_file.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package cat 5 6 import ( 7 "bytes" 8 "errors" 9 "os" 10 ) 11 12 func NewFile(name string, buf *bytes.Buffer) *File { 13 return &File{path: name, buf: buf} 14 } 15 16 type File struct { 17 buf *bytes.Buffer 18 path string 19 } 20 21 func (f *File) Close() error { 22 return nil 23 } 24 25 func (f *File) Name() string { 26 return f.path 27 } 28 29 func (f *File) Stat() (os.FileInfo, error) { 30 return nil, errors.New("not implemented") 31 } 32 33 func (f *File) Sync() error { 34 return nil 35 } 36 37 func (f *File) Truncate(size int64) error { 38 return nil 39 } 40 41 func (f *File) Read(b []byte) (n int, err error) { 42 return f.buf.Read(b) 43 } 44 45 func (f *File) ReadAt(b []byte, off int64) (n int, err error) { 46 return 0, errors.New("not implemented") 47 } 48 49 func (f *File) Readdir(count int) (res []os.FileInfo, err error) { 50 return nil, errors.New("not implemented") 51 } 52 53 func (f *File) Readdirnames(n int) (names []string, err error) { 54 return nil, errors.New("not implemented") 55 } 56 57 func (f *File) Seek(offset int64, whence int) (int64, error) { 58 return 0, errors.New("not implemented") 59 } 60 61 func (f *File) Write(b []byte) (n int, err error) { 62 return 0, errors.New("not implemented") 63 } 64 65 func (f *File) WriteAt(b []byte, off int64) (n int, err error) { 66 return 0, errors.New("not implemented") 67 } 68 69 func (f *File) WriteString(s string) (ret int, err error) { 70 return 0, errors.New("not implemented") 71 }