final-stream
Advanced tools
Comparing version 2.0.1 to 2.0.2
20
index.js
@@ -12,2 +12,11 @@ const { promisify } = require('util'); | ||
let finished = false; | ||
function finish () { | ||
if (finished) { | ||
return; | ||
} | ||
finished = true; | ||
callback(null, Buffer.concat(body)); | ||
} | ||
stream | ||
@@ -17,7 +26,10 @@ .on('data', function (chunk) { | ||
}) | ||
.on('close', function () { | ||
callback(null, Buffer.concat(body)); | ||
}) | ||
.on('destroy', finish) | ||
.on('end', finish) | ||
.on('close', finish) | ||
.on('error', function (error) { | ||
if (finished) { | ||
console.log(error); | ||
return; | ||
} | ||
callback(error); | ||
@@ -24,0 +36,0 @@ }); |
{ | ||
"name": "final-stream", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A tool to read a full stream and callback once finished with the data", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
13439
116