thread-stream
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -17,3 +17,3 @@ 'use strict' | ||
const threadStreamSync = new ThreadStream({ | ||
filename: join(__dirname, 'test', 'to-file'), | ||
filename: join(__dirname, 'test', 'to-file.js'), | ||
workerData: { dest: '/dev/null' }, | ||
@@ -24,3 +24,3 @@ bufferSize: 4 * 1024 * 1024, | ||
const threadStreamAsync = new ThreadStream({ | ||
filename: join(__dirname, 'test', 'to-file'), | ||
filename: join(__dirname, 'test', 'to-file.js'), | ||
workerData: { dest: '/dev/null' }, | ||
@@ -27,0 +27,0 @@ bufferSize: 4 * 1024 * 1024, |
@@ -6,2 +6,3 @@ 'use strict' | ||
const { join } = require('path') | ||
const { pathToFileURL } = require('url') | ||
const { wait } = require('./lib/wait') | ||
@@ -20,3 +21,5 @@ const { | ||
workerData: { | ||
filename, | ||
filename: filename.indexOf('file://') === 0 | ||
? filename | ||
: pathToFileURL(filename).href, | ||
dataBuf: stream._dataBuf, | ||
@@ -23,0 +26,0 @@ stateBuf: stream._stateBuf, |
@@ -6,3 +6,2 @@ 'use strict' | ||
const { waitDiff } = require('./wait') | ||
const fn = require(workerData.filename) | ||
@@ -20,2 +19,3 @@ const { | ||
async function start () { | ||
const fn = (await import(workerData.filename)).default | ||
destination = await fn(workerData.workerData) | ||
@@ -42,2 +42,6 @@ | ||
process.nextTick(run) | ||
}).catch(function (err) { | ||
// TODO transfer this to main? | ||
console.error(err) | ||
process.exit(1) | ||
}) | ||
@@ -44,0 +48,0 @@ |
{ | ||
"name": "thread-stream", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "A streaming way to send data to a Node.js Worker Thread", | ||
"main": "index.js", | ||
"devDependencies": { | ||
"desm": "^1.1.0", | ||
"fastbench": "^1.0.1", | ||
"husky": "^5.1.3", | ||
"nyc": "^15.1.0", | ||
"sonic-boom": "^1.3.2", | ||
"standard": "^16.0.3", | ||
"tap-dot": "^2.0.0", | ||
"tape": "^5.2.2" | ||
"tap": "^15.0.0" | ||
}, | ||
"scripts": { | ||
"cov": "nyc tape test/*.test.js | tap-dot", | ||
"test": "standard && tape test/*.test.js | tap-dot", | ||
"ci": "standard && tape test/*.test.js", | ||
"test": "standard && tap --no-check-coverage test/*.test.*js", | ||
"prepare": "husky install" | ||
@@ -20,0 +17,0 @@ }, |
'use strict' | ||
const test = require('tape') | ||
const { test } = require('tap') | ||
const { join } = require('path') | ||
@@ -34,3 +34,3 @@ const { tmpdir } = require('os') | ||
const stream = new ThreadStream({ | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest }, | ||
@@ -71,3 +71,3 @@ sync: true | ||
bufferSize: 128, | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest }, | ||
@@ -112,3 +112,3 @@ sync: true | ||
bufferSize: 128, | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest }, | ||
@@ -161,3 +161,3 @@ sync: false | ||
bufferSize: 10, | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest }, | ||
@@ -198,3 +198,3 @@ sync: true | ||
bufferSize: 10, | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest }, | ||
@@ -233,3 +233,3 @@ sync: false | ||
bufferSize: 128, | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest }, | ||
@@ -236,0 +236,0 @@ sync: false |
'use strict' | ||
const test = require('tape') | ||
const { test } = require('tap') | ||
const { join } = require('path') | ||
@@ -39,3 +39,3 @@ const { tmpdir } = require('os') | ||
const stream = new ThreadStream({ | ||
filename: join(__dirname, 'to-file'), | ||
filename: join(__dirname, 'to-file.js'), | ||
workerData: { dest } | ||
@@ -42,0 +42,0 @@ }) |
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
23020
6
16
760
7