then-read-stream
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -12,2 +12,3 @@ "use strict"; | ||
} | ||
const maxStreamReadSize = 1 * 1024 * 1024; // Maximum request length on read-stream operation | ||
/** | ||
@@ -75,4 +76,9 @@ * Error message | ||
// continue reading from stream if required | ||
if (remaining > 0 && !this.endOfStream) { | ||
bytesRead += await this._read(buffer, offset + bytesRead, remaining); | ||
while (remaining > 0 && !this.endOfStream) { | ||
const reqLen = Math.min(remaining, maxStreamReadSize); | ||
const chunkLen = await this._read(buffer, offset + bytesRead, reqLen); | ||
bytesRead += chunkLen; | ||
if (chunkLen < reqLen) | ||
break; | ||
remaining -= chunkLen; | ||
} | ||
@@ -79,0 +85,0 @@ return bytesRead; |
{ | ||
"name": "then-read-stream", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Read from a readable stream just like a file", | ||
@@ -42,7 +42,7 @@ "author": { | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.11.1", | ||
"@types/node": "^12.12.3", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.7", | ||
"del-cli": "^3.0.0", | ||
"mocha": "^6.2.1", | ||
"mocha": "^6.2.2", | ||
"nyc": "^14.1.1", | ||
@@ -49,0 +49,0 @@ "remark-cli": "^7.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12775
185