How to use the redis/redis-client.convertMultiBulkBuffersToUTF8Strings function in redis

To help you get started, we’ve selected a few redis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github persvr / perstore / store / redis.js View on Github external
return callAsync(db.sort, args).then(function(results){
				// FIXME: should be async?
				redis.convertMultiBulkBuffersToUTF8Strings(results);
				if (!results) results = [];
////
				/*results = results.toString('UTF8');
				if (jsArrayQuery) results = JSONExt.parse('['+results+']');*/
////
//dir('RES?:', results);
				// convert flat array into array of objects
				var fields = options.fields || ['id'];
				var flen = fields.length;
				var len = results.length;
				var hash = {};
				var r = [];
				for (var i = 0, j = 0; i < len; ++i) {
					var value = results[i];
					// TODO: apply auto-conversions (number, boolean) here?
					// TODO: make use of schema
github persvr / perstore / store / redis.js View on Github external
db.hgetall(collection+':'+path.shift(), function(err, obj){
				if (err) {promise.reject(err); throw new URIError(err);}
				if (obj) {
					redis.convertMultiBulkBuffersToUTF8Strings(obj);
					redisHashToRealHash(obj);
//dir('GET', obj);
					if (!obj.id) obj.id = id;
					for (var i = 0; i < path.length; i++) {
						var p = decodeURIComponent(path[i]);
						if (!obj) break;
						obj = obj.get ? obj.get(p) : obj[p];
					}
				}
				promise.resolve(obj||undefined);
			});
			return promise;