{"action":"closed","issue":{"url":"https://api.github.com/repos/joyent/node/issues/7470","labels_url":"https://api.github.com/repos/joyent/node/issues/7470/labels{/name}","comments_url":"https://api.github.com/repos/joyent/node/issues/7470/comments","events_url":"https://api.github.com/repos/joyent/node/issues/7470/events","html_url":"https://github.com/joyent/node/issues/7470","id":31522758,"number":7470,"title":"Streams: Make uncork behavior configurable on end","user":{"login":"ashaffer","id":1871136,"avatar_url":"https://avatars.githubusercontent.com/u/1871136?v=3","gravatar_id":"","url":"https://api.github.com/users/ashaffer","html_url":"https://github.com/ashaffer","followers_url":"https://api.github.com/users/ashaffer/followers","following_url":"https://api.github.com/users/ashaffer/following{/other_user}","gists_url":"https://api.github.com/users/ashaffer/gists{/gist_id}","starred_url":"https://api.github.com/users/ashaffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashaffer/subscriptions","organizations_url":"https://api.github.com/users/ashaffer/orgs","repos_url":"https://api.github.com/users/ashaffer/repos","events_url":"https://api.github.com/users/ashaffer/events{/privacy}","received_events_url":"https://api.github.com/users/ashaffer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joyent/node/labels/feature-request","name":"feature-request","color":"0b02e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2014-04-15T03:06:01Z","updated_at":"2015-08-26T18:40:48Z","closed_at":"2015-08-26T18:40:47Z","body":"Cross-posting from here: https://github.com/isaacs/readable-stream/issues/91 per request.\r\n\r\nI understand the logic behind defaulting to uncorking on end, to prevent people forgetting to uncork, but you lose an enormous amount of power and flexibility by not making this optional.  For instance, I am trying to write a streaming ssh module, which pipes commands from some source over a connection, like this:\r\n\r\n```javascript\r\nfs.createReadStream('script.sh')\r\n  .pipe(ssh({host: 'server.com'})\r\n  .pipe(consoleStream());\r\n```\r\n\r\nAnd I would like to simply cork the ssh stream until the connection is open.  The problem of course is that the read stream usually finishes (causing an uncork) before the connection has fully opened.\r\n\r\nIf this behavior is made configurable, streams are capable of completely replacing flow-control libraries like async/seq/step, among other things.  It seems like an enormous amount of power to sacrifice just to avoid a certain type of error, especially if its simply an opt-in configuration option."}}