
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
A mutex/semaphore implementation made easy to use.
superlock aims to be:
async and await$ npm install superlock --save
The lock is a mutex by default:
const { setTimeout } = require('timers/promises')
const { withLock } = require('superlock')
const lock = withLock()
const executions = await Promise.all(
[...Array(10).keys()].map(index =>
lock(async () => {
await setTimeout(Math.random() * 100)
return index
})
)
)
console.log(executions)
Just call withLock(n) being n the maximum of concurrency desired for the lock.
It returns a function that can be used to wrap any code you want to execute with concurrency control:
const { withLock } = require('superlock')
const lock = withLock()
await lock(() => {
/* your code execution */
})
The lock will be automatically released after your code execution is done even if an error occurred, avoiding deadlock situations.
Type: number
Default: 1
It sets the maximum of concurrency allowed for the lock.
Type: boolean
It returns false if there is at least one free concurrency slots in the lock.
superlock © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.
kikobeats.com · GitHub Kiko Beats · X @Kikobeats
FAQs
The most simple mutex/semaphore implementation
The npm package superlock receives a total of 1,320 weekly downloads. As such, superlock popularity was classified as popular.
We found that superlock demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.