stream2: flush extant data on read of ended stream
authorChris Dickinson <christopher.s.dickinson@gmail.com>
Wed, 9 Jul 2014 09:16:45 +0000 (02:16 -0700)
committerFedor Indutny <fedor@indutny.com>
Tue, 15 Jul 2014 08:38:23 +0000 (12:38 +0400)
commita96d6603b3be28b97029d5d150e761aeb172434d
treea8d82b1e9df6d2af8b31500c42b719c19bbd3109
parent7f86baf5c7713b6bd541b549352795fe8a55b9de
stream2: flush extant data on read of ended stream

A ReadableStream with a base64 StringDecoder backed by only
one or two bytes would fail to output its partial data before
ending. This fix adds a check to see if the `read` was triggered
by an internal `flow`, and if so, empties any remaining data.

fixes #7914.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
lib/_stream_readable.js
test/simple/test-stream2-base64-single-char-read-end.js [new file with mode: 0644]