{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/6798","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/6798/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/6798/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/6798/events","html_url":"https://github.com/nodejs/node/issues/6798","id":155157203,"number":6798,"title":"streams: Readable highWaterMark is measured in bytes *or* characters","user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars3.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"labels":[{"id":155435883,"url":"https://api.github.com/repos/nodejs/node/labels/stream","name":"stream","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":27,"created_at":"2016-05-17T01:22:45Z","updated_at":"2017-05-30T07:32:57Z","closed_at":null,"body":"- **Version**: all\n- **Platform**: all\n- **Subsystem**: streams\n\nCurrently the Readable streams documentation states that `highWaterMark` is measured in bytes for non-object mode streams. However, when `.setEncoding()` is called on the Readable stream, then `highWaterMark` is measured in characters and _not_ bytes since [`state.length += chunk.length`](https://github.com/nodejs/node/blob/0e7d57af3573b4dcba81217bba2f041dbdc173dc/lib/_stream_readable.js#L176) happens _after_ [`chunk` is overwritten with a decoded string](https://github.com/nodejs/node/blob/0e7d57af3573b4dcba81217bba2f041dbdc173dc/lib/_stream_readable.js#L160) and [`state.length` is what is compared with `highWaterMark`](https://github.com/nodejs/node/blob/0e7d57af3573b4dcba81217bba2f041dbdc173dc/lib/_stream_readable.js#L207).\n\nThis seems to be an issue since at least v0.10, so I wasn't sure if we should just update the documentation to note this behavior or if we should change the existing behavior to match the documentation.\n\n/cc @nodejs/streams\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/304798095","html_url":"https://github.com/nodejs/node/issues/6798#issuecomment-304798095","issue_url":"https://api.github.com/repos/nodejs/node/issues/6798","id":304798095,"user":{"login":"mcollina","id":52195,"avatar_url":"https://avatars3.githubusercontent.com/u/52195?v=3","gravatar_id":"","url":"https://api.github.com/users/mcollina","html_url":"https://github.com/mcollina","followers_url":"https://api.github.com/users/mcollina/followers","following_url":"https://api.github.com/users/mcollina/following{/other_user}","gists_url":"https://api.github.com/users/mcollina/gists{/gist_id}","starred_url":"https://api.github.com/users/mcollina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcollina/subscriptions","organizations_url":"https://api.github.com/users/mcollina/orgs","repos_url":"https://api.github.com/users/mcollina/repos","events_url":"https://api.github.com/users/mcollina/events{/privacy}","received_events_url":"https://api.github.com/users/mcollina/received_events","type":"User","site_admin":false},"created_at":"2017-05-30T07:32:57Z","updated_at":"2017-05-30T07:32:57Z","body":"I think the best approach about this issue is to update the documentation. An actual fix proved to be way harder, and it might slow things down considerably.\r\n\r\nWould anyone update the docs? Maybe @jessicaquynh?"}}
{"actor":{"display_login":"mcollina"}}