
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
锁住代码片段,缓存等待队列,控制并发
$ npm i lockx --save
const Lock = require('lockx');
const lockName = 'test';
let index = 10;
while (index-- > 0) {
Lock.lock(lockName, { index }, async function (data) {
console.log('\n----lock----', data);
let result = void (0);
try {
result = await doSomeing();
console.log('result->',result);
} catch (error) {
console.error('error->',error);
} finally {
console.log('----unlock----\n');
Lock.unlock(lockName);
}
});
}
function doSomeing() {
return new Promise((resolve, reject) => {
let time = Math.floor(Math.random() * 10);
let red = '\033[0;31;1m';
let normal = '\033[0;38;1m';
let green = '\033[0;32;1m';
setTimeout(() => {
resolve(time < 5 ? `${green}小于5s${normal}` : `${red}大于5s${normal}`);
}, time * 500);
});
}
lockx
没有设置过期清除,所以要保证lock
后一定要unlock
,强烈建议用上try/catch
FAQs
[新API]锁住你的代码片段,缓存等待队列,控制并发
The npm package lockx receives a total of 1 weekly downloads. As such, lockx popularity was classified as not popular.
We found that lockx 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.