Browse Source

Improve readme (#154)

Improved the README.md file to include an example of storing and reading a file.
Ben Osborne 6 years ago
parent
commit
9bf9e0098a
1 changed files with 22 additions and 0 deletions
  1. 22 0
      README.md

+ 22 - 0
README.md

@@ -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))
+```