Documentation ¶
Overview ¶
Package gowebdav is a WebDAV client library.
Index ¶
- Variables
- func FixSlash(s string) string
- func FixSlashes(s string) string
- func Join(path0 string, path1 string) string
- func PathEscape(path string) string
- func String(r io.Reader) string
- type Authenticator
- type BasicAuth
- type Client
- func (c *Client) Connect() error
- func (c *Client) Copy(oldpath, newpath string, overwrite bool) error
- func (c *Client) Mkdir(path string, _ os.FileMode) error
- func (c *Client) MkdirAll(path string, _ os.FileMode) error
- func (c *Client) Read(path string) ([]byte, error)
- func (c *Client) ReadDir(path string) ([]os.FileInfo, error)
- func (c *Client) ReadStream(path string) (io.ReadCloser, error)
- func (c *Client) Remove(path string) error
- func (c *Client) RemoveAll(path string) error
- func (c *Client) Rename(oldpath, newpath string, overwrite bool) error
- func (c *Client) SetHeader(key, value string)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) SetTransport(transport http.RoundTripper)
- func (c *Client) Stat(path string) (os.FileInfo, error)
- func (c *Client) Write(path string, data []byte, _ os.FileMode) error
- func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error
- type DigestAuth
- type File
- func (f *File) ContentType() string
- func (f *File) ETag() string
- func (f *File) IsDir() bool
- func (f *File) ModTime() time.Time
- func (f *File) Mode() os.FileMode
- func (f *File) Name() string
- func (f *File) Path() string
- func (f *File) SetContentType(contentType string)
- func (f *File) SetEtag(etag string)
- func (f *File) SetIsDir(isDir bool)
- func (f *File) SetModified(modified time.Time)
- func (f *File) SetName(name string)
- func (f *File) SetPath(path string)
- func (f *File) SetSize(size int64)
- func (f *File) Size() int64
- func (f *File) String() string
- func (f *File) Sys() interface{}
- type NoAuth
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *gulu.Logger
Functions ¶
func FixSlashes ¶
FixSlashes appends and prepends a / if they are missing
func PathEscape ¶
PathEscape escapes all segemnts of a given path
Example ¶
fmt.Println(PathEscape("")) fmt.Println(PathEscape("/")) fmt.Println(PathEscape("/web")) fmt.Println(PathEscape("/web/")) fmt.Println(PathEscape("/w e b/d a v/s%u&c#k:s/")) fmt.Println(PathEscape("/目录1/目录2/"))
Output: / /web /web/ /w%20e%20b/d%20a%20v/s%25u&c%23k:s/ /%E7%9B%AE%E5%BD%951/%E7%9B%AE%E5%BD%952/
Types ¶
type Authenticator ¶
type Authenticator interface { Type() string User() string Pass() string Authorize(*http.Request, string, string) }
Authenticator stub
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth structure holds our credentials
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines our structure
func (*Client) ReadStream ¶
func (c *Client) ReadStream(path string) (io.ReadCloser, error)
ReadStream reads the stream for a given path
func (*Client) SetTimeout ¶
SetTimeout exposes the ability to set a time limit for requests
func (*Client) SetTransport ¶
func (c *Client) SetTransport(transport http.RoundTripper)
SetTransport exposes the ability to define custom transports
type DigestAuth ¶
type DigestAuth struct {
// contains filtered or unexported fields
}
DigestAuth structure holds our credentials
func (*DigestAuth) Authorize ¶
func (d *DigestAuth) Authorize(req *http.Request, method string, path string)
Authorize the current request
func (*DigestAuth) Type ¶
func (d *DigestAuth) Type() string
Type identifies the DigestAuthenticator
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is our structure for a given file
func (*File) ContentType ¶
ContentType returns the content type of a file
func (*File) SetContentType ¶ added in v1.1.1
func (*File) SetModified ¶ added in v1.1.1
Click to show internal directories.
Click to hide internal directories.