
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
A simple interface between Workers.
npm install --save battalion
To expose an interface from a Worker:
// src/worker-module.js
import Battalion from 'battalion'
Battalion.export(self, {
addTwo ({ first, second }) {
return first + second
}
})
Then, to create / access that worker from the main thread:
// src/index.js
import Battalion from 'battalion'
import MyWorker from './worker-module' // import worker with webpack / worker-loader
let battalion = new Battalion(MyWorker)
let workerInstance = battalion.createInstance()
workerInstance.dispatch('addTwo', { first: 1, second: 2 }).then((result) => {
console.log(result) // => 3
})
Options object:
Promise
: the Promise implementation to use (defaults to Promise
)Task
: the Task implementation to use (uses Promises by default)MyWorker
: Worker class.
Exposes methods from a worker file.
context
: The worker context (should be self
)
methods
: Object containing methods that will be called by dispatch
.
Returns a WorkerInstance
.
count
: Number of workers to use.
Returns a PoolInstance
.
Assign a worker instance a job.
type
: Name of exported function to run.
data
: Object that will be passed to the function.
Returns a Promise (or Task) of the eventual result.
Same as above, but will be distributed among available workers.
callback
: Function, will be called when a job is complete.
Receives an object containing two properties: completed
(total number of completed jobs) and pending
(jobs in job queue).
Resets the completed
jobs count and empties the existing job queue.
FAQs
Web worker management utilities
We found that battalion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.