@ -34,13 +34,15 @@ function doRead(handle, length) {
returnbuffer;
returnbuffer;
}elseif(result.bytesRead<length){
}elseif(result.bytesRead<length){
// TODO: For possible future performance optimization, consider reusing the remaining Buffer allocation for a next read, if possible. Need more data on how often this case occurs first, though, to justify the added complexity.
// TODO: For possible future performance optimization, consider reusing the remaining Buffer allocation for a next read, if possible. Need more data on how often this case occurs first, though, to justify the added complexity.
returnbuffer.slice(0,length);
returnbuffer.slice(0,result.bytesRead);
}else{
}else{
thrownewError(`Read more bytes (${result.bytesRead}) than the specified 'length' (${length}); this should never happen!`);
thrownewError(`Read more bytes (${result.bytesRead}) than the specified 'length' (${length}); this should never happen!`);
}
}
});
});
}
}
// FIXME: This should probably *only* allow reading mode flags