Gathering detailed insights and metrics for @broxus/await-semaphore
Gathering detailed insights and metrics for @broxus/await-semaphore
Gathering detailed insights and metrics for @broxus/await-semaphore
Gathering detailed insights and metrics for @broxus/await-semaphore
npm install @broxus/await-semaphore
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
66 Stars
18 Commits
18 Forks
4 Watchers
1 Branches
2 Contributors
Updated on Jun 13, 2025
Latest Version
0.1.5
Package Id
@broxus/await-semaphore@0.1.5
Unpacked Size
8.11 kB
Size
3.06 kB
File Count
5
NPM Version
8.5.4
Node Version
17.7.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
NOTE: it is a fork of old
await-semaphore
package but with some fixes
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.
1import {Semaphore} from 'await-semaphore'; 2 3var semaphore = new Semaphore(10);
Acquire the semaphore and returns a promise for the release function. Be sure to handle release for exception case.
1semaphore.acquire() 2.then(release => { 3 //critical section... 4 doSomething() 5 .then(res => { 6 //... 7 release(); 8 }) 9 .catch(err => { 10 //... 11 release(); 12 }); 13});
Alternate method for using the semaphore by providing a thunk. This automatically handles acquire/release.
1semaphore.use(() => { 2 //critical section... 3});
An alias for new Semaphore(1)
. Mutex has the same methods as Semaphore.
1import {Mutex} from 'await-semaphore'; 2 3var mutex = new Mutex();
Create a version of fetch()
with concurrency limited to 10.
1var semaphore = new Semaphore(10); 2 3async function niceFetch(url) { 4 var release = await semaphore.acquire(); 5 var result = await fetch(url); 6 release(); 7 return result; 8}
1var semaphore = new Semaphore(10); 2 3function niceFetch(url) { 4 return semaphore.use(() => fetch(url)); 5}
1var semaphore = new Semaphore(10); 2 3function niceFetch(url) { 4 return semaphore.acquire() 5 .then(release => { 6 return fetch(url) 7 .then(result => { 8 release(); 9 return result; 10 }); 11 }); 12}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/15 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
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
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