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