forked from enviPath/enviPy
Current Dev State
This commit is contained in:
25
static/js/ketcher2/node_modules/htmlparser2/lib/WritableStream.js
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/htmlparser2/lib/WritableStream.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
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();
|
||||
};
|
||||
Reference in New Issue
Block a user