Update README.md
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/README.md b/README.md
index 0033700..2ff751e 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,8 @@ gem install mpd_client
All functionality is contained in the `MPD::Client` class. Creating an instance of this class is as simple as:
```ruby
+require 'mpd_client'
+
client = MPD::Client.new
```
@@ -64,6 +66,26 @@ client.status # insert the status command into the list
client.command_list_end # result will be a Array with the results
```
+### Binary responses
+
+Some commands can return binary data.
+
+```ruby
+require 'mpd_client'
+
+client = MPD::Client.new
+client.connect('localhost', 6600)
+
+if (current_song = client.currentsong)
+ data, io = client.albumart(current_song['file'])
+ io # StringIO
+ data # => {"size"=>"322860", "binary"=>"3372"}
+ File.write('cover.jpg', io.string)
+end
+```
+
+The above will locate album art for the current song and save image to `cover.jpg` file.
+
### Ranges
Some commands(e.g. `move`, `delete`, `load`, `shuffle`, `playlistinfo`) support integer ranges(`[START:END]`) as argument. This is done in `mpd_client` by using two element array: