From 331c7dde466d522ca7532862dd75643bea252823 Mon Sep 17 00:00:00 2001 From: Brian Hammond Date: Fri, 9 Apr 2010 15:31:53 -0400 Subject: [PATCH] allow others to use convertMultiBulkRepliesToUTF8 --- lib/redis-client.js | 17 ++++++++ seed.yml | 2 +- test/test.js | 101 +++++++++++++++++++------------------------- 3 files changed, 62 insertions(+), 58 deletions(-) diff --git a/lib/redis-client.js b/lib/redis-client.js index 1126c02..c34ac26 100644 --- a/lib/redis-client.js +++ b/lib/redis-client.js @@ -721,3 +721,20 @@ Client.prototype.unsubscribeFrom = function (nameOrPattern) { this[method](nameOrPattern); }; +// Multi-bulk replies return an array of other replies. Perhaps all you care +// about is the representation of such buffers as UTF-8 encoded strings? Use +// this to convert each such Buffer to a (UTF-8 encoded) String in-place. + +exports.convertMultiBulkBuffersToUTF8Strings = function (o) { + if (o instanceof Array) { + for (var i=0; i