- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.6k
Closed
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
In the following testcase the _flush callback is not being called after stream.end().
Simply removing the stream.write(null); line works fine.
Is it possible to end a stream with stream.write(null) and stream.end() or only the latter.
If so, why does stream.write(null) prevent stream.end() from triggering _flush?
var Transform = require('readable-stream/transform'),
    inherits  = require('util').inherits;
function MyTransform(opts){
  Transform.call(this, opts);
}
inherits(MyTransform, Transform);
MyTransform.prototype._transform = function( chunk, enc, next ){
  console.log('.');
  next();
};
MyTransform.prototype._flush = function(){
  console.log('END');
};
// ---
var stream = new MyTransform({ objectMode: true });
stream.write({ a: 'b' });
stream.write(null);
stream.end();same behaviour on v0.11.14 and v0.10.33
ref: #89
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.