Socket
Socket
Sign inDemoInstall

thread-stream

Package Overview
Dependencies
1
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.13.2 to 0.14.0

10

index.js

@@ -107,2 +107,7 @@ 'use strict'

stream.flush(() => {
// err is already handled in flush()
if (stream.destroyed) {
return
}
Atomics.store(stream[kImpl].state, READ_INDEX, 0)

@@ -259,3 +264,6 @@ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0)

if (this[kImpl].destroyed) {
throw new Error('the worker has exited')
if (typeof cb === 'function') {
process.nextTick(cb, new Error('the worker has exited'))
}
return
}

@@ -262,0 +270,0 @@

4

package.json
{
"name": "thread-stream",
"version": "0.13.2",
"version": "0.14.0",
"description": "A streaming way to send data to a Node.js Worker Thread",

@@ -15,3 +15,3 @@ "main": "index.js",

"standard": "^16.0.3",
"tap": "^15.0.0",
"tap": "^16.0.0",
"why-is-node-running": "^2.2.0"

@@ -18,0 +18,0 @@ },

@@ -249,1 +249,24 @@ 'use strict'

})
test('destroy does not error', function (t) {
t.plan(3)
const dest = file()
const stream = new ThreadStream({
filename: join(__dirname, 'to-file.js'),
workerData: { dest },
sync: false
})
stream.on('ready', () => {
t.pass('ready emitted')
stream.worker.terminate()
})
stream.on('error', (err) => {
t.equal(err.message, 'The worker thread exited')
stream.flush((err) => {
t.equal(err.message, 'the worker has exited')
})
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc