Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
run-with-limit
Advanced tools
Run multiple promise-returning & async functions with limited concurrency. Heavily inspired by sindresorhus/p-limit.
import { makeRunWithLimit } from "https://denopkg.com/alextes/run-with-limit";
const { runWithLimit } = makeRunWithLimit(1);
(async () => {
// Only one promise is run at once
const result = await Promise.all([
runWithLimit(() => fetchSomething("foo")),
runWithLimit(() => fetchSomething("bar")),
runWithLimit(() => doSomething()),
]);
console.log(result);
})();
Number => { runWithLimit, getActiveCount, getPendingCount }
Takes a number, setting the concurrency for the promise queue. Returns a set of functions to use the queue.
<A>(() => Promise<A>) => Promise<A>
Pass a thunk to this function that returns a promise.
That is, pass a function which when invoked, kicks off an asynchronous computation, and if you need its result, returns a promise. runWithLimit
will resolve with said result while honoring the concurrency limit.
() => Number
Call to get the number of promises that are currently running.
() => Number
Call to check how many promises are still waiting to start execution.
FAQs
Run promises with limited concurrency
The npm package run-with-limit receives a total of 2 weekly downloads. As such, run-with-limit popularity was classified as not popular.
We found that run-with-limit 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.