update README
This commit is contained in:
parent
056ad2c4d5
commit
5a1a85f622
11
Makefile
11
Makefile
@ -11,7 +11,16 @@ ${BIN}: ${SRC}
|
|||||||
test:
|
test:
|
||||||
go test ./...
|
go test ./...
|
||||||
|
|
||||||
|
api:
|
||||||
|
@sed '/^## API$$/,$$d' -i README.md
|
||||||
|
@echo '## API' >> README.md
|
||||||
|
@godoc2md github.com/studio-b12/gowebdav | sed '/^$$/N;/^\n$$/D' |\
|
||||||
|
sed '2d' |\
|
||||||
|
sed 's/\/src\/github.com\/studio-b12\/gowebdav\//https:\/\/github.com\/studio-b12\/gowebdav\/blob\/master\//g' |\
|
||||||
|
sed 's/\/src\/target\//https:\/\/github.com\/studio-b12\/gowebdav\/blob\/master\//g' |\
|
||||||
|
sed 's/^#/##/g' >> README.md
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f ${BIN}
|
@rm -f ${BIN}
|
||||||
|
|
||||||
.PHONY: all cmd clean test
|
.PHONY: all cmd clean test api
|
||||||
|
269
README.md
269
README.md
@ -1,10 +1,269 @@
|
|||||||
# GOWEBDAV - WebDAV Client for golang
|
# GoWebDAV
|
||||||
|
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/studio-b12/gowebdav)](https://goreportcard.com/report/github.com/studio-b12/gowebdav)
|
||||||
|
|
||||||
|
A WebDAV client and library for golang.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go get -u github.com/studio-b12/gowebdav/cmd/gowebdav
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ ./gowebdav
|
||||||
|
Usage: gowebdav FLAGS ARGS
|
||||||
|
Flags:
|
||||||
|
-X string
|
||||||
|
Method ... (default "GET")
|
||||||
|
-pw string
|
||||||
|
password
|
||||||
|
-root string
|
||||||
|
WebDAV Endpoint (default "URL")
|
||||||
|
-user string
|
||||||
|
user
|
||||||
|
Method <ARGS>
|
||||||
|
LS | LIST | PROPFIND <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>
|
||||||
|
PUT | PUSH | WRITE <PATH> <FILE>
|
||||||
|
STAT <PATH>
|
||||||
|
```
|
||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* [rfc2518](http://www.faqs.org/rfcs/rfc2518.html "RFC 2518 - HTTP Extensions for Distributed Authoring -- WEBDAV")
|
* [RFC 2518 - HTTP Extensions for Distributed Authoring -- WEBDAV](http://www.faqs.org/rfcs/rfc2518.html "RFC 2518 - HTTP Extensions for Distributed Authoring -- WEBDAV")
|
||||||
* [rfc2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html "HTTP/1.1 Status Code Definitions")
|
* [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")
|
||||||
|
|
||||||
## Books
|
## API
|
||||||
|
|
||||||
* [WebDav: Next Gen](https://books.google.de/books?isbn=0130652083 "WebDav: Next Generation Collaborative Web Authoring By Lisa Dusseault")
|
`import "github.com/studio-b12/gowebdav"`
|
||||||
|
|
||||||
|
* [Overview](#pkg-overview)
|
||||||
|
* [Index](#pkg-index)
|
||||||
|
* [Subdirectories](#pkg-subdirectories)
|
||||||
|
|
||||||
|
### <a name="pkg-overview">Overview</a>
|
||||||
|
A golang WebDAV library
|
||||||
|
|
||||||
|
### <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 String(r io.Reader) string](#String)
|
||||||
|
* [type Client](#Client)
|
||||||
|
* [func NewClient(uri string, user string, pw string) *Client](#NewClient)
|
||||||
|
* [func (c *Client) Connect() error](#Client.Connect)
|
||||||
|
* [func (c *Client) Copy(oldpath string, 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 string, 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 File](#File)
|
||||||
|
* [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) Size() int64](#File.Size)
|
||||||
|
* [func (f File) String() string](#File.String)
|
||||||
|
|
||||||
|
##### <a name="pkg-files">Package files</a>
|
||||||
|
[client.go](https://github.com/studio-b12/gowebdav/blob/master/client.go) [file.go](https://github.com/studio-b12/gowebdav/blob/master/file.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=491:521#L35)
|
||||||
|
``` 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=643:675#L43)
|
||||||
|
``` 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=760:804#L51)
|
||||||
|
``` go
|
||||||
|
func Join(path0 string, path1 string) string
|
||||||
|
```
|
||||||
|
Join joins two paths
|
||||||
|
|
||||||
|
### <a name="String">func</a> [String](https://github.com/studio-b12/gowebdav/blob/master/utils.go?s=934:965#L56)
|
||||||
|
``` go
|
||||||
|
func String(r io.Reader) string
|
||||||
|
```
|
||||||
|
String pulls a string out of our io.Reader
|
||||||
|
|
||||||
|
### <a name="Client">type</a> [Client](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=203:284#L18)
|
||||||
|
``` go
|
||||||
|
type Client struct {
|
||||||
|
// contains filtered or unexported fields
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Client defines our structure
|
||||||
|
|
||||||
|
#### <a name="NewClient">func</a> [NewClient](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=332:390#L25)
|
||||||
|
``` go
|
||||||
|
func NewClient(uri string, user string, pw string) *Client
|
||||||
|
```
|
||||||
|
NewClient creates a new instance of client
|
||||||
|
|
||||||
|
#### <a name="Client.Connect">func</a> (\*Client) [Connect](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1135:1167#L55)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Connect() error
|
||||||
|
```
|
||||||
|
Connect connects to our dav server
|
||||||
|
|
||||||
|
#### <a name="Client.Copy">func</a> (\*Client) [Copy](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5866:5941#L283)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Copy(oldpath string, newpath string, overwrite bool) error
|
||||||
|
```
|
||||||
|
Copy copies a file from A to B
|
||||||
|
|
||||||
|
#### <a name="Client.Mkdir">func</a> (\*Client) [Mkdir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=4950:5006#L242)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Mkdir(path string, _ os.FileMode) error
|
||||||
|
```
|
||||||
|
Mkdir makes a directory
|
||||||
|
|
||||||
|
#### <a name="Client.MkdirAll">func</a> (\*Client) [MkdirAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5185:5244#L253)
|
||||||
|
``` go
|
||||||
|
func (c *Client) MkdirAll(path string, _ os.FileMode) error
|
||||||
|
```
|
||||||
|
MkdirAll like mkdir -p, but for webdav
|
||||||
|
|
||||||
|
#### <a name="Client.Read">func</a> (\*Client) [Read](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6047:6097#L288)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Read(path string) ([]byte, error)
|
||||||
|
```
|
||||||
|
Read reads the contents of a remote file
|
||||||
|
|
||||||
|
#### <a name="Client.ReadDir">func</a> (\*Client) [ReadDir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=2143:2203#L100)
|
||||||
|
``` go
|
||||||
|
func (c *Client) ReadDir(path string) ([]os.FileInfo, error)
|
||||||
|
```
|
||||||
|
ReadDir reads the contents of a remote directory
|
||||||
|
|
||||||
|
#### <a name="Client.ReadStream">func</a> (\*Client) [ReadStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6409:6472#L307)
|
||||||
|
``` go
|
||||||
|
func (c *Client) ReadStream(path string) (io.ReadCloser, error)
|
||||||
|
```
|
||||||
|
ReadStream reads the stream for a given path
|
||||||
|
|
||||||
|
#### <a name="Client.Remove">func</a> (\*Client) [Remove](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=4456:4498#L219)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Remove(path string) error
|
||||||
|
```
|
||||||
|
Remove removes a remote file
|
||||||
|
|
||||||
|
#### <a name="Client.RemoveAll">func</a> (\*Client) [RemoveAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=4564:4609#L224)
|
||||||
|
``` go
|
||||||
|
func (c *Client) RemoveAll(path string) error
|
||||||
|
```
|
||||||
|
RemoveAll removes remote files
|
||||||
|
|
||||||
|
#### <a name="Client.Rename">func</a> (\*Client) [Rename](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5693:5770#L278)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Rename(oldpath string, newpath string, overwrite bool) error
|
||||||
|
```
|
||||||
|
Rename moves a file from A to B
|
||||||
|
|
||||||
|
#### <a name="Client.SetHeader">func</a> (\*Client) [SetHeader](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=718:763#L40)
|
||||||
|
``` go
|
||||||
|
func (c *Client) SetHeader(key, value string)
|
||||||
|
```
|
||||||
|
SetHeader lets us set arbitrary headers for a given client
|
||||||
|
|
||||||
|
#### <a name="Client.SetTimeout">func</a> (\*Client) [SetTimeout](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=863:913#L45)
|
||||||
|
``` go
|
||||||
|
func (c *Client) SetTimeout(timeout time.Duration)
|
||||||
|
```
|
||||||
|
SetTimeout exposes the ability to set a time limit for requests
|
||||||
|
|
||||||
|
#### <a name="Client.SetTransport">func</a> (\*Client) [SetTransport](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1006:1064#L50)
|
||||||
|
``` go
|
||||||
|
func (c *Client) SetTransport(transport http.RoundTripper)
|
||||||
|
```
|
||||||
|
SetTransport exposes the ability to define custom transports
|
||||||
|
|
||||||
|
#### <a name="Client.Stat">func</a> (\*Client) [Stat](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=3471:3526#L167)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Stat(path string) (os.FileInfo, error)
|
||||||
|
```
|
||||||
|
Stat returns the file stats for a specified path
|
||||||
|
|
||||||
|
#### <a name="Client.Write">func</a> (\*Client) [Write](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6763:6832#L322)
|
||||||
|
``` go
|
||||||
|
func (c *Client) Write(path string, data []byte, _ os.FileMode) error
|
||||||
|
```
|
||||||
|
Write writes data to a given path
|
||||||
|
|
||||||
|
#### <a name="Client.WriteStream">func</a> (\*Client) [WriteStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7297:7377#L348)
|
||||||
|
``` go
|
||||||
|
func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error
|
||||||
|
```
|
||||||
|
WriteStream writes a stream
|
||||||
|
|
||||||
|
### <a name="File">type</a> [File](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=93:198#L10)
|
||||||
|
``` go
|
||||||
|
type File struct {
|
||||||
|
// contains filtered or unexported fields
|
||||||
|
}
|
||||||
|
```
|
||||||
|
File is our structure for a given file
|
||||||
|
|
||||||
|
#### <a name="File.IsDir">func</a> (File) [IsDir](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=697:723#L44)
|
||||||
|
``` 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=581:614#L39)
|
||||||
|
``` 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=410:442#L29)
|
||||||
|
``` 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=235:262#L19)
|
||||||
|
``` go
|
||||||
|
func (f File) Name() string
|
||||||
|
```
|
||||||
|
Name returns the name of a file
|
||||||
|
|
||||||
|
#### <a name="File.Size">func</a> (File) [Size](https://github.com/studio-b12/gowebdav/blob/master/file.go?s=318:344#L24)
|
||||||
|
``` 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=784:813#L49)
|
||||||
|
``` go
|
||||||
|
func (f File) String() string
|
||||||
|
```
|
||||||
|
String lets us see file information
|
||||||
|
|
||||||
|
- - -
|
||||||
|
Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)
|
||||||
|
Loading…
Reference in New Issue
Block a user