New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

microjob

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microjob - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "microjob",
"version": "0.1.0",
"version": "0.1.1",
"description": "A tiny wrapper for Node.js worker_threads lib",

@@ -5,0 +5,0 @@ "main": "src/job.js",

@@ -30,13 +30,15 @@ const v8 = require('v8')

const dataStr = JSON.stringify(config.data)
const dataSerialized = v8.serialize(config.data)
const dataStr = JSON.stringify(dataSerialized)
const workerStr = `
async function __executor__() {
const v8 = require('v8')
${variables}
return await (${handler.toString()})(JSON.parse('${dataStr}'))
const dataParsed = JSON.parse('${dataStr}')
const dataBuffer = Buffer.from(dataParsed.data)
const dataDeserialized = v8.deserialize(dataBuffer)
return await (${handler.toString()})(dataDeserialized)
}
`
// serialization precheck, due to this issue: https://github.com/nodejs/node/issues/22736
v8.serialize(config.data)
worker.once('message', message => {

@@ -43,0 +45,0 @@ workerPool.free(worker)

@@ -16,3 +16,3 @@ const { Worker } = require('worker_threads')

for (let i = 0; i < maxWorkers; i++) {
const worker = new Worker('./src/worker.js')
const worker = new Worker(`${__dirname}/worker.js`)

@@ -19,0 +19,0 @@ worker.once('online', () => {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc