From 9bf9e0098a39780a596a5cd3eb69b14784d8a4f8 Mon Sep 17 00:00:00 2001 From: Ben Osborne Date: Thu, 18 Jul 2019 20:16:16 +0100 Subject: [PATCH] Improve readme (#154) Improved the README.md file to include an example of storing and reading a file. --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 9059ddf..c9df01e 100644 --- a/README.md +++ b/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)) +```