Sha256: aae3b4c04671bdd90c9a4e3fb2bf2c4deb645ae6b84cb768da64f5c8b2732606

Contents?: true

Size: 730 Bytes

Versions: 24

Compression:

Stored size: 730 Bytes

Contents

module.exports = Stream;

var Parser = require("./Parser.js");
var WritableStream = require("readable-stream").Writable;
var StringDecoder = require("string_decoder").StringDecoder;
var Buffer = require("buffer").Buffer;

function Stream(cbs, options) {
    var parser = (this._parser = new Parser(cbs, options));
    var decoder = (this._decoder = new StringDecoder());

    WritableStream.call(this, { decodeStrings: false });

    this.once("finish", function() {
        parser.end(decoder.end());
    });
}

require("inherits")(Stream, WritableStream);

Stream.prototype._write = function(chunk, encoding, cb) {
    if (chunk instanceof Buffer) chunk = this._decoder.write(chunk);
    this._parser.write(chunk);
    cb();
};

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.7 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.6 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.5 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.4 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.3 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.2 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.1 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.3.5 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-5.0.0 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.3.4 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.3.3 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.3.2 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.3.1 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.3 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.2.3 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.2.2 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.2.1 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.2 node_modules/htmlparser2/lib/WritableStream.js
trusty-cms-4.1.9 node_modules/htmlparser2/lib/WritableStream.js