initial commit
This commit is contained in:
commit
f6e1813d15
7 changed files with 296 additions and 0 deletions
46
file.go
Normal file
46
file.go
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (C) 2019 Marius Schellenberger
|
||||
|
||||
package authdav
|
||||
|
||||
import (
|
||||
"golang.org/x/net/webdav"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
// File is a wrapper for webdav.File providing write only functionality
|
||||
type File struct {
|
||||
f webdav.File
|
||||
}
|
||||
|
||||
func (f *File) Close() error {
|
||||
return f.f.Close()
|
||||
}
|
||||
|
||||
func (f *File) Read(p []byte) (int, error) {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
func (f *File) Seek(offset int64, whence int) (int64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (f *File) Readdir(count int) (fi []os.FileInfo, err error) {
|
||||
ffi, err := f.f.Readdir(count)
|
||||
for _, f := range ffi {
|
||||
fi = append(fi, &FileInfo{f})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (f *File) Stat() (os.FileInfo, error) {
|
||||
fi, err := f.f.Stat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &FileInfo{fi}, nil
|
||||
}
|
||||
|
||||
func (f *File) Write(p []byte) (int, error) {
|
||||
return f.f.Write(p)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue