Sha256: a6f21c41f4ba249c8859ca752d536ca865a1d9b5c7691d87aede03566b72f99a

Contents?: true

Size: 1.05 KB

Versions: 15

Compression:

Stored size: 1.05 KB

Contents

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

15 entries across 15 versions & 1 rubygems

Version Path
express_translate-1.0.13 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.12 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.11 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.10 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.9 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.8 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.7 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.6 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.5 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.4 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.3 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.2 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.1 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0 node_modules/redis/lib/parser/hiredis.js
express_translate-1.0.0.0 node_modules/redis/lib/parser/hiredis.js