Skip to content

Commit

Permalink
fix(readBuffer): handle 0-byte reads
Browse files Browse the repository at this point in the history
without this onChunk will infinitely wait for data
  • Loading branch information
pycka authored and sokra committed Sep 15, 2017
1 parent 42f9f96 commit c7ca960
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/readBuffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export default function readBuffer(pipe, length, callback) {
if (length === 0) {
callback(null, new Buffer(0));
return;
}
let remainingLength = length;
const buffers = [];
const readChunk = () => {
Expand Down

0 comments on commit c7ca960

Please sign in to comment.