module.exports = function (RED) {
    var Liner = require('liner');

    function ReadLine(n) {
        RED.nodes.createNode(this, n);
        this.name = n.name;
        this.topic = n.topic;
        this.file = n.file;
        this.offset = n.offset;
        this.limit = n.limit;
        var node = this;


        node.on('close', function (done) {
            node.status({});
            done();
        });

        node.on('input', function (msg) {
            var file = null;
            if (msg.filename !== undefined && msg.filename !== "") {
                file = msg.filename;
            } else {
                file = node.file;
            }
            var liner = new Liner(file);
            var i = 0;
            var lim = 0;
                        
            liner.on('readable', function () {
                while (true) {
                    var line = liner.read();
                    if (line === null) {
                        break;
                    }
                    if(i < node.offset){
                        i++;
                        continue;
                    }
                    if(node.limit > 0 && lim >= node.limit){
                        liner.end();
                        break;
                    }
                        
                    msg['payload'] = line;
                    msg['line'] = i+1;
                    
                    lim++;
                    i++;
                    node.send([msg, null]);
                }
            });
            liner.on('error', function (err) {
                node.error(err);
            });
            liner.on('end', function () {
                msg['line'] = undefined;
                msg['payload'] = i;
                node.send([null, msg]);
            });

        });

    }
    RED.nodes.registerType("read-line", ReadLine);
};

@@ -58,24 +58,25 @@
 ('liner');%0A%0A
+%0A
     function
@@ -455,37 +455,8 @@
 ) %7B%0A
-            var file = null;%0A
     
@@ -1834,11 +1834,13 @@
 dLine);%0A
+%0A%0A
 %7D;%0A

Revert "duhh"