docs
This commit is contained in:
parent
5a1a85f622
commit
732590873e
@ -13,7 +13,7 @@ go get -u github.com/studio-b12/gowebdav/cmd/gowebdav
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ./gowebdav
|
$ gowebdav
|
||||||
Usage: gowebdav FLAGS ARGS
|
Usage: gowebdav FLAGS ARGS
|
||||||
Flags:
|
Flags:
|
||||||
-X string
|
-X string
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// Package gowebdav A golang WebDAV library
|
||||||
package gowebdav
|
package gowebdav
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -35,7 +36,7 @@ func NewClient(uri string, user string, pw string) *Client {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHeaders lets us set arbitrary headers for a given client
|
// SetHeader lets us set arbitrary headers for a given client
|
||||||
func (c *Client) SetHeader(key, value string) {
|
func (c *Client) SetHeader(key, value string) {
|
||||||
c.headers.Add(key, value)
|
c.headers.Add(key, value)
|
||||||
}
|
}
|
||||||
@ -308,13 +309,14 @@ func (c *Client) ReadStream(path string) (io.ReadCloser, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, newPathErrorErr("ReadStream", path, err)
|
return nil, newPathErrorErr("ReadStream", path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rs.StatusCode == 200 {
|
if rs.StatusCode == 200 {
|
||||||
return rs.Body, nil
|
return rs.Body, nil
|
||||||
} else {
|
}
|
||||||
|
|
||||||
rs.Body.Close()
|
rs.Body.Close()
|
||||||
return nil, newPathError("ReadStream", path, rs.StatusCode)
|
return nil, newPathError("ReadStream", path, rs.StatusCode)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Write writes data to a given path
|
// Write writes data to a given path
|
||||||
func (c *Client) Write(path string, data []byte, _ os.FileMode) error {
|
func (c *Client) Write(path string, data []byte, _ os.FileMode) error {
|
||||||
|
2
utils.go
2
utils.go
@ -55,7 +55,7 @@ func Join(path0 string, path1 string) string {
|
|||||||
// String pulls a string out of our io.Reader
|
// String pulls a string out of our io.Reader
|
||||||
func String(r io.Reader) string {
|
func String(r io.Reader) string {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
// TODO - mkae String return an error as well
|
// TODO - make String return an error as well
|
||||||
_, _ = buf.ReadFrom(r)
|
_, _ = buf.ReadFrom(r)
|
||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user