Sha256: 21b0a8b37f1c2c0ae99417cdd2695f4c3a9903e42fd9732007c0e6b1df242cca

Contents?: true

Size: 1.07 KB

Versions: 17

Compression:

Stored size: 1.07 KB

Contents

/*global Buffer require exports console setTimeout */

var events = require("events"),
    util = require("../util"),
    hiredis = require("hiredis");

exports.debug_mode = false;
exports.name = "hiredis";

function HiredisReplyParser(options) {
    this.name = exports.name;
    this.options = options || {};
    this.reset();
    events.EventEmitter.call(this);
}

util.inherits(HiredisReplyParser, events.EventEmitter);

exports.Parser = HiredisReplyParser;

HiredisReplyParser.prototype.reset = function () {
    this.reader = new hiredis.Reader({
        return_buffers: this.options.return_buffers || false
    });
};

HiredisReplyParser.prototype.execute = function (data) {
    var reply;
    this.reader.feed(data);
    while (true) {
        try {
          reply = this.reader.get();
        } catch (err) {
          this.emit("error", err);
          break;
        }

        if (reply === undefined) break;

        if (reply && reply.constructor === Error) {
            this.emit("reply error", reply);
        } else {
            this.emit("reply", reply);
        }
    }
};

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/lib/parser/hiredis.js