
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.
@broxus/await-semaphore
Advanced tools
Awaitable semaphore/mutex
A semaphore implementation using ES6 promises and supporting 3 styles:
Also includes Mutex
as a convenience for new Semaphore(1)
.
Create a new semaphore with the given count.
import {Semaphore} from 'await-semaphore';
var semaphore = new Semaphore(10);
Acquire the semaphore and returns a promise for the release function. Be sure to handle release for exception case.
semaphore.acquire()
.then(release => {
//critical section...
doSomething()
.then(res => {
//...
release();
})
.catch(err => {
//...
release();
});
});
Alternate method for using the semaphore by providing a thunk. This automatically handles acquire/release.
semaphore.use(() => {
//critical section...
});
An alias for new Semaphore(1)
. Mutex has the same methods as Semaphore.
import {Mutex} from 'await-semaphore';
var mutex = new Mutex();
Create a version of fetch()
with concurrency limited to 10.
var semaphore = new Semaphore(10);
async function niceFetch(url) {
var release = await semaphore.acquire();
var result = await fetch(url);
release();
return result;
}
var semaphore = new Semaphore(10);
function niceFetch(url) {
return semaphore.use(() => fetch(url));
}
var semaphore = new Semaphore(10);
function niceFetch(url) {
return semaphore.acquire()
.then(release => {
return fetch(url)
.then(result => {
release();
return result;
});
});
}
FAQs
Awaitable semaphore/mutex [Fork of await-semaphore]
The npm package @broxus/await-semaphore receives a total of 872 weekly downloads. As such, @broxus/await-semaphore popularity was classified as not popular.
We found that @broxus/await-semaphore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.