cmd/gowebdav | ||
.gitignore | ||
.travis.yml | ||
client.go | ||
file.go | ||
LICENSE | ||
Makefile | ||
README.md | ||
requests.go | ||
utils_test.go | ||
utils.go |
GoWebDAV
A WebDAV client and library for golang.
Install
go get -u github.com/studio-b12/gowebdav/cmd/gowebdav
Usage
Usage: gowebdav FLAGS ARGS
Flags:
-X string
Method (default "GET")
-pw string
Password [ENV.PASSWORD]
-root string
WebDAV Endpoint [ENV.ROOT]
-user string
User [ENV.USER]
Method <ARGS>
LS | LIST | PROPFIND <PATH>
STAT <PATH>
RM | DELETE | DEL <PATH>
MKDIR | MKCOL <PATH>
MKDIRALL | MKCOLALL <PATH>
MV | MOVE | RENAME <OLD_PATH> <NEW_PATH>
CP | COPY <OLD_PATH> <NEW_PATH>
GET | PULL | READ <PATH> <FILE>
PUT | PUSH | WRITE <PATH> <FILE>
Example
ROOT="https://webdav.server/" \
USER="foo" \
PASSWORD="bar" \
./gowebdav -X LS /
LINKS
- RFC 2518 - HTTP Extensions for Distributed Authoring -- WEBDAV
- RFC 2616 - HTTP/1.1 Status Code Definitions
- WebDav: Next Generation Collaborative Web Authoring By Lisa Dusseaul
API
import "github.com/studio-b12/gowebdav"
Overview
Package gowebdav A golang WebDAV library
Index
- 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 Client
- func NewClient(uri string, user string, pw string) *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 File
Examples
Package files
client.go file.go requests.go utils.go
func FixSlash
func FixSlash(s string) string
FixSlash appends a trailing / to our string
func FixSlashes
func FixSlashes(s string) string
FixSlashes appends and prepends a / if they are missing
func Join
func Join(path0 string, path1 string) string
Join joins two paths
func PathEscape
func PathEscape(path string) string
PathEscape escapes all segemnts of a given path
func String
func String(r io.Reader) string
String pulls a string out of our io.Reader
type Client
type Client struct {
// contains filtered or unexported fields
}
Client defines our structure
func NewClient
func NewClient(uri string, user string, pw string) *Client
NewClient creates a new instance of client
func (*Client) Connect
func (c *Client) Connect() error
Connect connects to our dav server
func (*Client) Copy
func (c *Client) Copy(oldpath, newpath string, overwrite bool) error
Copy copies a file from A to B
func (*Client) Mkdir
func (c *Client) Mkdir(path string, _ os.FileMode) error
Mkdir makes a directory
func (*Client) MkdirAll
func (c *Client) MkdirAll(path string, _ os.FileMode) error
MkdirAll like mkdir -p, but for webdav
func (*Client) Read
func (c *Client) Read(path string) ([]byte, error)
Read reads the contents of a remote file
func (*Client) ReadDir
func (c *Client) ReadDir(path string) ([]os.FileInfo, error)
ReadDir reads the contents of a remote directory
func (*Client) ReadStream
func (c *Client) ReadStream(path string) (io.ReadCloser, error)
ReadStream reads the stream for a given path
func (*Client) Remove
func (c *Client) Remove(path string) error
Remove removes a remote file
func (*Client) RemoveAll
func (c *Client) RemoveAll(path string) error
RemoveAll removes remote files
func (*Client) Rename
func (c *Client) Rename(oldpath, newpath string, overwrite bool) error
Rename moves a file from A to B
func (*Client) SetHeader
func (c *Client) SetHeader(key, value string)
SetHeader lets us set arbitrary headers for a given client
func (*Client) SetTimeout
func (c *Client) SetTimeout(timeout time.Duration)
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
func (*Client) Stat
func (c *Client) Stat(path string) (os.FileInfo, error)
Stat returns the file stats for a specified path
func (*Client) Write
func (c *Client) Write(path string, data []byte, _ os.FileMode) error
Write writes data to a given path
func (*Client) WriteStream
func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error
WriteStream writes a stream
type File
type File struct {
// contains filtered or unexported fields
}
File is our structure for a given file
func (File) ContentType
func (f File) ContentType() string
ContentType returns the content type of a file
func (File) ETag
func (f File) ETag() string
ETag returns the ETag of a file
func (File) IsDir
func (f File) IsDir() bool
IsDir let us see if a given file is a directory or not
func (File) ModTime
func (f File) ModTime() time.Time
ModTime returns the modified time of a file
func (File) Mode
func (f File) Mode() os.FileMode
Mode will return the mode of a given file
func (File) Name
func (f File) Name() string
Name returns the name of a file
func (File) Size
func (f File) Size() int64
Size returns the size of a file
func (File) String
func (f File) String() string
String lets us see file information
func (File) Sys
func (f File) Sys() interface{}
Sys ????
Generated by godoc2md