Skip to content
Browse files

read callback should be called after everything was read.

  • Loading branch information...
1 parent 8cded7a commit dd0854ea35b05f4f13e99d5081c9dbebd43d4b01 @Gozala committed
Showing with 1 addition and 4 deletions.
  1. +1 −4 lib/fs.js
View
5 lib/fs.js
@@ -560,13 +560,10 @@ exports.read = function read(fd, buffer, offset, length, position, callback) {
readStream.on("data", function onData(chunck) {
chunck.copy(buffer, offset + bytesRead);
bytesRead += buffer.length;
- if (bytesRead >= length) {
- callback(null, bytesRead, buffer);
- }
});
readStream.on("end", function onEnd() {
+ callback(null, bytesRead, buffer);
readStream.destroy();
- console.log('The end!')
});
};

0 comments on commit dd0854e

Please sign in to comment.
Something went wrong with that request. Please try again.