2018-05-16 13:52:24 +02:00
# GoWebDAV
2018-05-17 00:05:28 +02:00
[![Build Status ](https://travis-ci.org/studio-b12/gowebdav.svg?branch=master )](https://travis-ci.org/studio-b12/gowebdav)
2018-05-25 23:26:18 +02:00
[![GoDoc ](https://godoc.org/github.com/studio-b12/gowebdav?status.svg )](https://godoc.org/github.com/studio-b12/gowebdav)
2018-05-16 13:52:24 +02:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/studio-b12/gowebdav )](https://goreportcard.com/report/github.com/studio-b12/gowebdav)
2018-10-21 20:49:28 +02:00
A golang WebDAV client library.
## Main features
`gowebdav` library allows to perform following actions on the remote WebDAV server:
* [create path ](#create-path-on-a-webdav-server )
* [get files list ](#get-files-list )
* [download file ](#download-file-to-byte-array )
* [upload file ](#upload-file-from-byte-array )
* [get information about specified file/folder ](#get-information-about-specified-filefolder )
* [move file to another location ](#move-file-to-another-location )
* [copy file to another location ](#copy-file-to-another-location )
* [delete file ](#delete-file )
2018-05-16 13:52:24 +02:00
## Usage
2018-10-21 20:49:28 +02:00
First of all you should create `Client` instance using `NewClient()` function:
2017-10-05 17:07:51 +02:00
2018-10-21 20:49:28 +02:00
```go
root := "https://webdav.mydomain.me"
user := "user"
password := "password"
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
c := gowebdav.NewClient(root, user, password)
2018-05-25 23:26:18 +02:00
```
2018-10-21 20:49:28 +02:00
After you can use this `Client` to perform actions, described below.
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
**NOTICE:** we will not check errors in examples, to focus you on the `gowebdav` library's code, but you should do it in your code!
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
### Create path on a WebDAV server
```go
err := c.Mkdir("folder", 0644)
2018-05-25 23:26:18 +02:00
```
2018-10-21 20:49:28 +02:00
In case you want to create several folders you can use `c.MkdirAll()` :
```go
err := c.MkdirAll("folder/subfolder/subfolder2", 0644)
2018-05-25 23:26:18 +02:00
```
2018-10-21 20:49:28 +02:00
### Get files list
```go
files, _ := c.ReadDir("folder/subfolder")
for _, file := range files {
//notice that [file] has os.FileInfo type
fmt.Println(file.Name())
2018-05-16 13:52:24 +02:00
}
```
2018-10-21 20:49:28 +02:00
### Download file to byte array
```go
webdavFilePath := "folder/subfolder/file.txt"
localFilePath := "/tmp/webdav/file.txt"
2018-05-16 13:52:24 +02:00
2018-10-21 20:49:28 +02:00
bytes, _ := c.Read(webdavFilePath)
ioutil.WriteFile(localFilePath, bytes, 0644)
2018-05-16 13:52:24 +02:00
```
2018-10-21 20:49:28 +02:00
### Download file via reader
Also you can use `c.ReadStream()` method:
```go
webdavFilePath := "folder/subfolder/file.txt"
localFilePath := "/tmp/webdav/file.txt"
2018-05-16 13:52:24 +02:00
2018-10-21 20:49:28 +02:00
reader, _ := c.ReadStream(webdavFilePath)
2018-05-16 13:52:24 +02:00
2018-10-21 20:49:28 +02:00
file, _ := os.Create(localFilePath)
defer file.Close()
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
io.Copy(file, reader)
2018-05-25 23:26:18 +02:00
```
2018-10-21 20:49:28 +02:00
### Upload file from byte array
```go
webdavFilePath := "folder/subfolder/file.txt"
localFilePath := "/tmp/webdav/file.txt"
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
bytes, _ := ioutil.ReadFile(localFilePath)
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
c.Write(webdavFilePath, bytes, 0644)
2018-05-25 23:26:18 +02:00
```
2018-10-21 20:49:28 +02:00
### Upload file via writer
```go
webdavFilePath := "folder/subfolder/file.txt"
localFilePath := "/tmp/webdav/file.txt"
2018-05-16 13:52:24 +02:00
2018-10-21 20:49:28 +02:00
file, _ := os.Open(localFilePath)
defer file.Close()
2017-11-26 17:23:14 +01:00
2018-10-21 20:49:28 +02:00
c.WriteStream(webdavFilePath, file, 0644)
2017-11-26 17:23:14 +01:00
```
2018-10-21 20:49:28 +02:00
### Get information about specified file/folder
```go
webdavFilePath := "folder/subfolder/file.txt"
2018-05-16 13:52:24 +02:00
2018-10-21 20:49:28 +02:00
info := c.Stat(webdavFilePath)
//notice that [info] has os.FileInfo type
fmt.Println(info)
2018-05-16 13:52:24 +02:00
```
2018-10-21 20:49:28 +02:00
### Move file to another location
```go
oldPath := "folder/subfolder/file.txt"
newPath := "folder/subfolder/moved.txt"
isOverwrite := true
2018-05-16 13:52:24 +02:00
2018-10-21 20:49:28 +02:00
c.Rename(oldPath, newPath, isOverwrite)
2018-05-16 13:52:24 +02:00
```
2018-10-21 20:49:28 +02:00
### Copy file to another location
```go
oldPath := "folder/subfolder/file.txt"
newPath := "folder/subfolder/file-copy.txt"
isOverwrite := true
2014-10-28 07:53:14 +01:00
2018-10-21 20:49:28 +02:00
c.Copy(oldPath, newPath, isOverwrite)
2018-05-16 13:52:24 +02:00
```
2014-10-28 07:53:14 +01:00
2018-10-21 20:49:28 +02:00
### Delete file
```go
webdavFilePath := "folder/subfolder/file.txt"
2018-05-16 14:35:38 +02:00
2018-10-21 20:49:28 +02:00
c.Remove(webdavFilePath)
2018-05-25 23:26:18 +02:00
```
2018-10-21 20:49:28 +02:00
## Links
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
More details about WebDAV server you can read from following resources:
2018-05-25 23:26:18 +02:00
2018-10-24 13:05:51 +02:00
* [RFC 4918 - HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV) ](https://tools.ietf.org/html/rfc4918 )
* [RFC 5689 - Extended MKCOL for Web Distributed Authoring and Versioning (WebDAV) ](https://tools.ietf.org/html/rfc5689 )
2018-10-21 20:49:28 +02:00
* [RFC 2616 - HTTP/1.1 Status Code Definitions ](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html "HTTP/1.1 Status Code Definitions" )
* [WebDav: Next Generation Collaborative Web Authoring By Lisa Dusseaul ](https://books.google.de/books?isbn=0130652083 "WebDav: Next Generation Collaborative Web Authoring By Lisa Dusseault" )
2018-05-25 23:26:18 +02:00
2018-10-24 13:05:51 +02:00
**NOTICE**: RFC 2518 is obsoleted by RFC 4918 in June 2007
2018-10-21 20:49:28 +02:00
## Contributing
All contributing are welcome. If you have any suggestions or find some bug - please create an Issue to let us make this project better. We appreciate your help!
2018-05-25 23:26:18 +02:00
2018-10-21 20:49:28 +02:00
## License
This library is distributed under the BSD 3-Clause license found in the [LICENSE ](https://github.com/studio-b12/gowebdav/blob/master/LICENSE ) file.
2020-03-03 16:07:24 +01:00
## API
`import "github.com/studio-b12/gowebdav"`
* [Overview ](#pkg-overview )
* [Index ](#pkg-index )
* [Examples ](#pkg-examples )
* [Subdirectories ](#pkg-subdirectories )
### <a name="pkg-overview">Overview</a>
Package gowebdav is a WebDAV client library with a command line tool
included.
### <a name="pkg-index">Index</a>
* [func FixSlash(s string) string ](#FixSlash )
* [func FixSlashes(s string) string ](#FixSlashes )
* [func Join(path0 string, path1 string) string ](#Join )
* [func PathEscape(path string) string ](#PathEscape )
* [func ReadConfig(uri, netrc string) (string, string) ](#ReadConfig )
* [func String(r io.Reader) string ](#String )
* [type Authenticator ](#Authenticator )
* [type BasicAuth ](#BasicAuth )
2020-09-29 10:07:39 +02:00
* [func (b *BasicAuth) Authorize(req *http.Request, method string, path string) ](#BasicAuth.Authorize )
2020-03-03 16:07:24 +01:00
* [func (b *BasicAuth) Pass() string ](#BasicAuth.Pass )
* [func (b *BasicAuth) Type() string ](#BasicAuth.Type )
* [func (b *BasicAuth) User() string ](#BasicAuth.User )
* [type Client ](#Client )
* [func NewClient(uri, user, pw string) *Client ](#NewClient )
* [func (c *Client) Connect() error ](#Client.Connect )
* [func (c *Client) Copy(oldpath, newpath string, overwrite bool) error ](#Client.Copy )
* [func (c *Client) Mkdir(path string, _ os.FileMode) error ](#Client.Mkdir )
* [func (c *Client) MkdirAll(path string, _ os.FileMode) error ](#Client.MkdirAll )
* [func (c *Client) Read(path string) ([]byte, error)](#Client.Read)
* [func (c *Client) ReadDir(path string) ([]os.FileInfo, error)](#Client.ReadDir)
* [func (c *Client) ReadStream(path string) (io.ReadCloser, error) ](#Client.ReadStream )
* [func (c *Client) Remove(path string) error ](#Client.Remove )
* [func (c *Client) RemoveAll(path string) error ](#Client.RemoveAll )
* [func (c *Client) Rename(oldpath, newpath string, overwrite bool) error ](#Client.Rename )
* [func (c *Client) SetHeader(key, value string) ](#Client.SetHeader )
* [func (c *Client) SetTimeout(timeout time.Duration) ](#Client.SetTimeout )
* [func (c *Client) SetTransport(transport http.RoundTripper) ](#Client.SetTransport )
* [func (c *Client) Stat(path string) (os.FileInfo, error) ](#Client.Stat )
* [func (c *Client) Write(path string, data []byte, _ os.FileMode) error](#Client.Write)
* [func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error ](#Client.WriteStream )
* [type DigestAuth ](#DigestAuth )
2020-09-29 10:07:39 +02:00
* [func (d *DigestAuth) Authorize(req *http.Request, method string, path string) ](#DigestAuth.Authorize )
2020-03-03 16:07:24 +01:00
* [func (d *DigestAuth) Pass() string ](#DigestAuth.Pass )
* [func (d *DigestAuth) Type() string ](#DigestAuth.Type )
* [func (d *DigestAuth) User() string ](#DigestAuth.User )
* [type File ](#File )
* [func (f File) ContentType() string ](#File.ContentType )
* [func (f File) ETag() string ](#File.ETag )
* [func (f File) IsDir() bool ](#File.IsDir )
* [func (f File) ModTime() time.Time ](#File.ModTime )
* [func (f File) Mode() os.FileMode ](#File.Mode )
* [func (f File) Name() string ](#File.Name )
* [func (f File) Path() string ](#File.Path )
* [func (f File) Size() int64 ](#File.Size )
* [func (f File) String() string ](#File.String )
* [func (f File) Sys() interface{} ](#File.Sys )
* [type NoAuth ](#NoAuth )
2020-09-29 10:07:39 +02:00
* [func (n *NoAuth) Authorize(req *http.Request, method string, path string) ](#NoAuth.Authorize )
2020-03-03 16:07:24 +01:00
* [func (n *NoAuth) Pass() string ](#NoAuth.Pass )
* [func (n *NoAuth) Type() string ](#NoAuth.Type )
* [func (n *NoAuth) User() string ](#NoAuth.User )
##### <a name="pkg-examples">Examples</a>
* [PathEscape ](#example_PathEscape )
##### <a name="pkg-files">Package files</a>
[basicAuth.go ](https://github.com/studio-b12/gowebdav/blob/master/basicAuth.go ) [client.go ](https://github.com/studio-b12/gowebdav/blob/master/client.go ) [digestAuth.go ](https://github.com/studio-b12/gowebdav/blob/master/digestAuth.go ) [doc.go ](https://github.com/studio-b12/gowebdav/blob/master/doc.go ) [file.go ](https://github.com/studio-b12/gowebdav/blob/master/file.go ) [netrc.go ](https://github.com/studio-b12/gowebdav/blob/master/netrc.go ) [requests.go ](https://github.com/studio-b12/gowebdav/blob/master/requests.go ) [utils.go ](https://github.com/studio-b12/gowebdav/blob/master/utils.go )
### <a name="FixSlash">func</a> [FixSlash](https://github.com/studio-b12/gowebdav/blob/master/utils.go?s=707:737#L45)
``` go
func FixSlash(s string) string
```
FixSlash appends a trailing / to our string
### <a name="FixSlashes">func</a> [FixSlashes](https://github.com/studio-b12/gowebdav/blob/master/utils.go?s=859:891#L53)
``` go
func FixSlashes(s string) string
```
FixSlashes appends and prepends a / if they are missing
### <a name="Join">func</a> [Join](https://github.com/studio-b12/gowebdav/blob/master/utils.go?s=976:1020#L61)
``` go
func Join(path0 string, path1 string) string
```
Join joins two paths
### <a name="PathEscape">func</a> [PathEscape](https://github.com/studio-b12/gowebdav/blob/master/utils.go?s=506:541#L36)
``` go
func PathEscape(path string) string
```
PathEscape escapes all segemnts of a given path
### <a name="ReadConfig">func</a> [ReadConfig](https://github.com/studio-b12/gowebdav/blob/master/netrc.go?s=428:479#L27)
``` go
func ReadConfig(uri, netrc string) (string, string)
```
ReadConfig reads login and password configuration from ~/.netrc
machine foo.com login username password 123456
### <a name="String">func</a> [String](https://github.com/studio-b12/gowebdav/blob/master/utils.go?s=1150:1181#L66)
``` go
func String(r io.Reader) string
```
String pulls a string out of our io.Reader
2020-09-29 10:07:39 +02:00
### <a name="Authenticator">type</a> [Authenticator](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=318:437#L27)
2020-03-03 16:07:24 +01:00
``` go
type Authenticator interface {
Type() string
User() string
Pass() string
2020-09-29 10:07:39 +02:00
Authorize(*http.Request, string, string)
2020-03-03 16:07:24 +01:00
}
```
Authenticator stub
2020-09-29 10:07:39 +02:00
### <a name="BasicAuth">type</a> [BasicAuth](https://github.com/studio-b12/gowebdav/blob/master/basicAuth.go?s=106:157#L9)
2020-03-03 16:07:24 +01:00
``` go
type BasicAuth struct {
// contains filtered or unexported fields
}
```
BasicAuth structure holds our credentials
2020-09-29 10:07:39 +02:00
#### <a name="BasicAuth.Authorize">func</a> (\*BasicAuth) [Authorize](https://github.com/studio-b12/gowebdav/blob/master/basicAuth.go?s=473:549#L30)
2020-03-03 16:07:24 +01:00
``` go
2020-09-29 10:07:39 +02:00
func (b *BasicAuth) Authorize(req *http.Request, method string, path string)
2020-03-03 16:07:24 +01:00
```
Authorize the current request
2020-09-29 10:07:39 +02:00
#### <a name="BasicAuth.Pass">func</a> (\*BasicAuth) [Pass](https://github.com/studio-b12/gowebdav/blob/master/basicAuth.go?s=388:421#L25)
2020-03-03 16:07:24 +01:00
``` go
func (b *BasicAuth) Pass() string
```
Pass holds the BasicAuth password
2020-09-29 10:07:39 +02:00
#### <a name="BasicAuth.Type">func</a> (\*BasicAuth) [Type](https://github.com/studio-b12/gowebdav/blob/master/basicAuth.go?s=201:234#L15)
2020-03-03 16:07:24 +01:00
``` go
func (b *BasicAuth) Type() string
```
Type identifies the BasicAuthenticator
2020-09-29 10:07:39 +02:00
#### <a name="BasicAuth.User">func</a> (\*BasicAuth) [User](https://github.com/studio-b12/gowebdav/blob/master/basicAuth.go?s=297:330#L20)
2020-03-03 16:07:24 +01:00
``` go
func (b *BasicAuth) User() string
```
User holds the BasicAuth username
2020-09-29 10:07:39 +02:00
### <a name="Client">type</a> [Client](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=165:294#L17)
2020-03-03 16:07:24 +01:00
``` go
type Client struct {
// contains filtered or unexported fields
}
```
Client defines our structure
2020-09-29 10:07:39 +02:00
#### <a name="NewClient">func</a> [NewClient](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=949:993#L60)
2020-03-03 16:07:24 +01:00
``` go
func NewClient(uri, user, pw string) *Client
```
NewClient creates a new instance of client
2020-09-29 10:07:39 +02:00
#### <a name="Client.Connect">func</a> (\*Client) [Connect](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1577:1609#L80)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Connect() error
```
Connect connects to our dav server
2020-09-29 10:07:39 +02:00
#### <a name="Client.Copy">func</a> (\*Client) [Copy](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6437:6505#L306)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Copy(oldpath, newpath string, overwrite bool) error
```
Copy copies a file from A to B
2020-09-29 10:07:39 +02:00
#### <a name="Client.Mkdir">func</a> (\*Client) [Mkdir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5528:5584#L265)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Mkdir(path string, _ os.FileMode) error
```
Mkdir makes a directory
2020-09-29 10:07:39 +02:00
#### <a name="Client.MkdirAll">func</a> (\*Client) [MkdirAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5763:5822#L276)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) MkdirAll(path string, _ os.FileMode) error
```
MkdirAll like mkdir -p, but for webdav
2020-09-29 10:07:39 +02:00
#### <a name="Client.Read">func</a> (\*Client) [Read](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6611:6661#L311)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Read(path string) ([]byte, error)
```
Read reads the contents of a remote file
2020-09-29 10:07:39 +02:00
#### <a name="Client.ReadDir">func</a> (\*Client) [ReadDir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=2603:2663#L123)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) ReadDir(path string) ([]os.FileInfo, error)
```
ReadDir reads the contents of a remote directory
2020-09-29 10:07:39 +02:00
#### <a name="Client.ReadStream">func</a> (\*Client) [ReadStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6972:7035#L329)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) ReadStream(path string) (io.ReadCloser, error)
```
ReadStream reads the stream for a given path
2020-09-29 10:07:39 +02:00
#### <a name="Client.Remove">func</a> (\*Client) [Remove](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5034:5076#L242)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Remove(path string) error
```
Remove removes a remote file
2020-09-29 10:07:39 +02:00
#### <a name="Client.RemoveAll">func</a> (\*Client) [RemoveAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5142:5187#L247)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) RemoveAll(path string) error
```
RemoveAll removes remote files
2020-09-29 10:07:39 +02:00
#### <a name="Client.Rename">func</a> (\*Client) [Rename](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6271:6341#L301)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Rename(oldpath, newpath string, overwrite bool) error
```
Rename moves a file from A to B
2020-09-29 10:07:39 +02:00
#### <a name="Client.SetHeader">func</a> (\*Client) [SetHeader](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1160:1205#L65)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) SetHeader(key, value string)
```
SetHeader lets us set arbitrary headers for a given client
2020-09-29 10:07:39 +02:00
#### <a name="Client.SetTimeout">func</a> (\*Client) [SetTimeout](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1305:1355#L70)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) SetTimeout(timeout time.Duration)
```
SetTimeout exposes the ability to set a time limit for requests
2020-09-29 10:07:39 +02:00
#### <a name="Client.SetTransport">func</a> (\*Client) [SetTransport](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1448:1506#L75)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) SetTransport(transport http.RoundTripper)
```
SetTransport exposes the ability to define custom transports
2020-09-29 10:07:39 +02:00
#### <a name="Client.Stat">func</a> (\*Client) [Stat](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=3990:4045#L190)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Stat(path string) (os.FileInfo, error)
```
Stat returns the file stats for a specified path
2020-09-29 10:07:39 +02:00
#### <a name="Client.Write">func</a> (\*Client) [Write](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7326:7395#L344)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) Write(path string, data []byte, _ os.FileMode) error
```
Write writes data to a given path
2020-09-29 10:07:39 +02:00
#### <a name="Client.WriteStream">func</a> (\*Client) [WriteStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7751:7831#L367)
2020-03-03 16:07:24 +01:00
``` go
func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error
```
WriteStream writes a stream
### <a name="DigestAuth">type</a> [DigestAuth](https://github.com/studio-b12/gowebdav/blob/master/digestAuth.go?s=157:254#L14)
``` go
type DigestAuth struct {
// contains filtered or unexported fields
}
```
DigestAuth structure holds our credentials
2020-09-29 10:07:39 +02:00
#### <a name="DigestAuth.Authorize">func</a> (\*DigestAuth) [Authorize](https://github.com/studio-b12/gowebdav/blob/master/digestAuth.go?s=577:654#L36)
2020-03-03 16:07:24 +01:00
``` go
2020-09-29 10:07:39 +02:00
func (d *DigestAuth) Authorize(req *http.Request, method string, path string)
2020-03-03 16:07:24 +01:00
```
Authorize the current request
#### <a name="DigestAuth.Pass">func</a> (\*DigestAuth) [Pass](https://github.com/studio-b12/gowebdav/blob/master/digestAuth.go?s=491:525#L31)
``` go
func (d *DigestAuth) Pass() string
```
Pass holds the DigestAuth password
#### <a name="DigestAuth.Type">func</a> (\*DigestAuth) [Type](https://github.com/studio-b12/gowebdav/blob/master/digestAuth.go?s=299:333#L21)
``` go
func (d *DigestAuth) Type() string
```
Type identifies the DigestAuthenticator
#### <a name="DigestAuth.User">func</a> (\*DigestAuth) [User](https://github.com/studio-b12/gowebdav/blob/master/digestAuth.go?s=398:432#L26)
``` go
func (d *DigestAuth) User() string
```
User holds the DigestAuth username
### <a name="File">type</a> [File](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=93:253#L10)
``` go
type File struct {
// contains filtered or unexported fields
}
```
File is our structure for a given file
#### <a name="File.ContentType">func</a> (File) [ContentType](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=476:510#L31)
``` go
func (f File) ContentType() string
```
ContentType returns the content type of a file
#### <a name="File.ETag">func</a> (File) [ETag](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=929:956#L56)
``` go
func (f File) ETag() string
```
ETag returns the ETag of a file
#### <a name="File.IsDir">func</a> (File) [IsDir](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=1035:1061#L61)
``` go
func (f File) IsDir() bool
```
IsDir let us see if a given file is a directory or not
#### <a name="File.ModTime">func</a> (File) [ModTime](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=836:869#L51)
``` go
func (f File) ModTime() time.Time
```
ModTime returns the modified time of a file
#### <a name="File.Mode">func</a> (File) [Mode](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=665:697#L41)
``` go
func (f File) Mode() os.FileMode
```
Mode will return the mode of a given file
#### <a name="File.Name">func</a> (File) [Name](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=378:405#L26)
``` go
func (f File) Name() string
```
Name returns the name of a file
#### <a name="File.Path">func</a> (File) [Path](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=295:322#L21)
``` go
func (f File) Path() string
```
Path returns the full path of a file
#### <a name="File.Size">func</a> (File) [Size](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=573:599#L36)
``` go
func (f File) Size() int64
```
Size returns the size of a file
#### <a name="File.String">func</a> (File) [String](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=1183:1212#L71)
``` go
func (f File) String() string
```
String lets us see file information
#### <a name="File.Sys">func</a> (File) [Sys](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=1095:1126#L66)
``` go
func (f File) Sys() interface{}
```
Sys ????
2020-09-29 10:07:39 +02:00
### <a name="NoAuth">type</a> [NoAuth](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=481:529#L35)
2020-03-03 16:07:24 +01:00
``` go
type NoAuth struct {
// contains filtered or unexported fields
}
```
NoAuth structure holds our credentials
2020-09-29 10:07:39 +02:00
#### <a name="NoAuth.Authorize">func</a> (\*NoAuth) [Authorize](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=824:897#L56)
2020-03-03 16:07:24 +01:00
``` go
2020-09-29 10:07:39 +02:00
func (n *NoAuth) Authorize(req *http.Request, method string, path string)
2020-03-03 16:07:24 +01:00
```
Authorize the current request
2020-09-29 10:07:39 +02:00
#### <a name="NoAuth.Pass">func</a> (\*NoAuth) [Pass](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=742:772#L51)
2020-03-03 16:07:24 +01:00
``` go
func (n *NoAuth) Pass() string
```
Pass returns the current password
2020-09-29 10:07:39 +02:00
#### <a name="NoAuth.Type">func</a> (\*NoAuth) [Type](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=568:598#L41)
2020-03-03 16:07:24 +01:00
``` go
func (n *NoAuth) Type() string
```
Type identifies the authenticator
2020-09-29 10:07:39 +02:00
#### <a name="NoAuth.User">func</a> (\*NoAuth) [User](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=654:684#L46)
2020-03-03 16:07:24 +01:00
``` go
func (n *NoAuth) User() string
```
User returns the current user
- - -
Generated by [godoc2md ](http://godoc.org/github.com/davecheney/godoc2md )