Gathering detailed insights and metrics for throat
Gathering detailed insights and metrics for throat
Gathering detailed insights and metrics for throat
Gathering detailed insights and metrics for throat
Throttle a collection of promise returning functions
npm install throat
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
484 Stars
63 Commits
40 Forks
4 Watching
79 Branches
9 Contributors
Updated on 25 Sept 2024
Minified
Minified + Gzipped
JavaScript (95.52%)
TypeScript (4.48%)
Cumulative downloads
Total Downloads
Last day
-2.5%
3,136,042
Compared to previous day
Last week
5.4%
17,771,639
Compared to previous week
Last month
38.1%
64,339,316
Compared to previous month
Last year
-15.4%
620,301,932
Compared to previous year
8
Throttle the parallelism of an asynchronous, promise returning, function / functions. This has special utility when you set the concurrency to 1
. That way you get a mutually exclusive lock.
Professionally supported throat is now available
npm install throat
This returns a function that acts a bit like a lock (exactly as a lock if concurrency is 1).
Example, only 2 of the following functions will execute at any one time:
1const throat = require('throat')(2); 2 3const resA = throat(async () => { 4 /* async stuff... */ 5}); 6const resB = throat(async () => { 7 /* async stuff... */ 8}); 9const resC = throat(async () => { 10 /* async stuff... */ 11}); 12const resD = throat(async () => { 13 /* async stuff... */ 14}); 15const resE = throat(async () => { 16 /* async stuff... */ 17});
This returns a function that is an exact copy of worker
except that it will only execute up to concurrency
times in parallel before further requests are queued:
1const throat = require('throat'); 2 3const input = ['fileA.txt', 'fileB.txt', 'fileC.txt', 'fileD.txt']; 4const data = Promise.all( 5 input.map(throat(2, (fileName) => readFile(fileName))) 6);
Only 2 files will be read at a time, sometimes limiting parallelism in this way can improve scalability.
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 4/22 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More