final-stream
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -25,3 +25,2 @@ const { promisify } = require('util'); | ||
}) | ||
.on('destroy', finish) | ||
.on('end', finish) | ||
@@ -28,0 +27,0 @@ .on('close', finish) |
{ | ||
"name": "final-stream", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "A tool to read a full stream and callback once finished with the data", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -80,1 +80,25 @@ const test = require('tape'); | ||
}); | ||
test('when stream is destroyed prematurely', async t => { | ||
t.plan(1); | ||
const testFilePath = './test/testFiletoStream.txt'; | ||
const testFileContent = fs.readFileSync(testFilePath, 'utf8'); | ||
const stream = fs.createReadStream(testFilePath, { highWaterMark: 32 }); | ||
stream.destroy(); | ||
const result = await finalStream(stream); | ||
t.equal(result.toString(), ''); | ||
}); | ||
test('when stream is closed prematurely', async t => { | ||
t.plan(1); | ||
const testFilePath = './test/testFiletoStream.txt'; | ||
const testFileContent = fs.readFileSync(testFilePath, 'utf8'); | ||
const stream = fs.createReadStream(testFilePath, { highWaterMark: 32 }); | ||
stream.close(); | ||
const result = await finalStream(stream); | ||
t.equal(result.toString(), ''); | ||
}); |
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
14147
133