Title: [streams] _flush not being called · Issue #53 · nodejs/node · GitHub
Open Graph Title: [streams] _flush not being called · Issue #53 · nodejs/node
X Title: [streams] _flush not being called · Issue #53 · nodejs/node
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...
Open Graph 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)...
X 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)...
Opengraph URL: https://github.com/nodejs/node/issues/53
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[streams] _flush not being called","articleBody":"In the following testcase the `_flush` callback is not being called after `stream.end()`.\n\nSimply removing the `stream.write(null);` line works fine.\n\nIs it possible to end a stream with `stream.write(null)` and `stream.end()` or only the latter.\n\nIf so, why does `stream.write(null)` prevent `stream.end()` from triggering `_flush`?\n\n``` javascript\n\nvar Transform = require('readable-stream/transform'),\n inherits = require('util').inherits;\n\nfunction MyTransform(opts){\n Transform.call(this, opts);\n}\n\ninherits(MyTransform, Transform);\n\nMyTransform.prototype._transform = function( chunk, enc, next ){\n console.log('.');\n next();\n};\n\nMyTransform.prototype._flush = function(){\n console.log('END');\n};\n\n// ---\n\nvar stream = new MyTransform({ objectMode: true });\n\nstream.write({ a: 'b' });\nstream.write(null);\nstream.end();\n```\n\nsame behaviour on `v0.11.14` and `v0.10.33`\n\nref: https://github.com/iojs/io.js/issues/89\n","author":{"url":"https://github.com/missinglink","@type":"Person","name":"missinglink"},"datePublished":"2014-12-04T00:28:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/53/node/issues/53"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ee201ca9-d958-cd25-f2ce-ab91f46369af |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B48:3C7B3B:384D0A:4D1B5E:6A4D9EA2 |
| html-safe-nonce | b265f43b9fb193b19a73d934134198b1eb5d0b15bd4d1b85513cc8902995d295 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjQ4OjNDN0IzQjozODREMEE6NEQxQjVFOjZBNEQ5RUEyIiwidmlzaXRvcl9pZCI6IjYyNjI2Nzk4ODg0MDM5OTYzMjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 74f345e0d0be05dbf9081335e3e0cb00d5c66595913757b9037c5d6cf1b7811e |
| hovercard-subject-tag | issue:50913157 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/53/issue_layout |
| twitter:image | https://opengraph.githubassets.com/49ecd7fd4b98482e70caf49d9ab35a3aac8763e522c3229f59efc29a2d4477c7/nodejs/node/issues/53 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/49ecd7fd4b98482e70caf49d9ab35a3aac8763e522c3229f59efc29a2d4477c7/nodejs/node/issues/53 |
| og:image:alt | 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)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | missinglink |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7f13faa65cccc9b729d674da83335d5dcfdfd193 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width