Skip to content

Stream not emitting data event after pipe+unpipe #1041

Description

@dmail

The following should log 'ok' to the console but nothing is logged.

var stream = require('stream');
var pass = new stream.PassThrough();
var writable = new stream.Writable();

pass.pipe(writable); pass.unpipe(writable);
pass.on('data', function(chunk){ console.log(chunk.toString()); });
pass.write('ok');

Of course, commenting the line pass.pipe(writable); pass.unpipe(writable); fix the problem.

Can you explain me why?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.streamIssues and PRs related to Node.js streams.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions