项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

21 line
502 B

  1. module.exports = Stream;
  2. var Parser = require("./Parser.js"),
  3. WritableStream = require("stream").Writable || require("readable-stream").Writable;
  4. function Stream(cbs, options){
  5. var parser = this._parser = new Parser(cbs, options);
  6. WritableStream.call(this, {decodeStrings: false});
  7. this.once("finish", function(){
  8. parser.end();
  9. });
  10. }
  11. require("util").inherits(Stream, WritableStream);
  12. WritableStream.prototype._write = function(chunk, encoding, cb){
  13. this._parser.write(chunk);
  14. cb();
  15. };