Sha256: 63a2e14387ba3a2bdcb5792b7d182b477b975bd2e5b40ee7c0824adfd0753253

Contents?: true

Size: 727 Bytes

Versions: 19

Compression:

Stored size: 727 Bytes

Contents

module.exports = Stream;

var Parser = require("./Parser.js"),
    WritableStream = require("stream").Writable || require("readable-stream").Writable,
    StringDecoder = require("string_decoder").StringDecoder,
    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);

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

Version data entries

19 entries across 16 versions & 3 rubygems

Version Path
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/htmlparser2/lib/WritableStream.js
locomotivecms-3.4.0 app/javascript/node_modules/htmlparser2/lib/WritableStream.js
lanes-0.8.0 node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.10 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.9 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.8 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.7 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.6 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.5 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.4 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.3 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.2 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.1 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/htmlparser2/lib/WritableStream.js