Improve readme (#154)

Improved the README.md file to include an example of storing and reading a file.
This commit is contained in:
Ben Osborne 2019-07-18 20:16:16 +01:00 committed by Julien Laffaye
parent c1312a7102
commit 9bf9e0098a

View File

@ -32,3 +32,25 @@ if err := c.Quit(); err != nil {
log.Fatal(err)
}
```
## Store a file example ##
```go
data := bytes.NewBufferString("Hello World")
err = c.Stor("test-file.txt", data)
if err != nil {
panic(err)
}
```
## Read a file example ##
```go
r, err := c.Retr("test-file.txt")
if err != nil {
panic(err)
}
buf, err := ioutil.ReadAll(r)
println(string(buf))
```