Skip to content

Stream not emitting data event after pipe+unpipe #1041

Closed
@dmail

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions