@ -29,7 +29,11 @@ function doRead(handle, length) {
}).then((result) => {
if (result.bytesRead === 0) {
// Not documented; https://github.com/nodejs/node/issues/35363
return Promise.try(() => {
return handle.close();
}).then(() => {
throw new EndOfStream();
});
} else if (result.bytesRead === length) {
return buffer;
} else if (result.bytesRead < length) {