Gathering detailed insights and metrics for node-abort-controller
Gathering detailed insights and metrics for node-abort-controller
Gathering detailed insights and metrics for node-abort-controller
Gathering detailed insights and metrics for node-abort-controller
@nodesuite/abort
Native AbortController manager.
isomorphic-abort-controller
JavaScript library that exports window.AbortController in browser and `abort-controller` in node. That's all it does.
@beegru/node-abort-controller
AbortController for Node based on EventEmitter
@gjsify/abort-controller
Web AbortController module for Gjs
AbortController Polyfill for Node.JS based on EventEmitter
npm install node-abort-controller
Typescript
Module System
Node Version
NPM Version
99.7
Supply Chain
100
Quality
78.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
1,117,260,474
Last Day
491,606
Last Week
11,335,046
Last Month
48,738,815
Last Year
568,215,610
MIT License
54 Stars
75 Commits
14 Forks
1 Watchers
2 Branches
9 Contributors
Updated on Nov 06, 2024
Minified
Minified + Gzipped
Latest Version
3.1.1
Package Id
node-abort-controller@3.1.1
Unpacked Size
16.49 kB
Size
5.28 kB
File Count
13
NPM Version
6.14.17
Node Version
14.21.1
Published on
Jan 26, 2023
Cumulative downloads
Total Downloads
Last Day
3.5%
491,606
Compared to previous day
Last Week
-5.8%
11,335,046
Compared to previous week
Last Month
-1.6%
48,738,815
Compared to previous month
Last Year
44.1%
568,215,610
Compared to previous year
3
AbortController Polyfill for Node.JS based on EventEmitter for Node v14.6.x and below.
Are you using Node 14.7.0 or above? You don't need this! Node has AbortController
and AbortSignal
as builtin globals. In Node versions >=14.7.0 and <15.4.0 you can access the experimental implementation using --experimental-abortcontroller
.
fetch
1import fetch from "node-fetch"; 2import { AbortController } from "node-abort-controller"; 3 4const controller = new AbortController(); 5const signal = controller.signal; 6 7await fetch("https:/www.google.com", { signal }); 8 9// Abort fetch after 500ms. Effectively a timeout 10setTimeout(() => controller.abort(), 500);
fetch
function with a built in timeout1import { AbortController } from "node-abort-controller"; 2import fetch from "node-fetch"; 3 4const fetchWithTimeout = async (url = "") => { 5 const controller = new AbortController(); 6 const { signal } = controller; 7 8 const timeout = setTimeout(() => { 9 controller.abort(); 10 }, 5000); 11 12 const request = await fetch(url, { signal }); 13 14 clearTimeout(timeout); 15 16 const result = await req.json(); 17 18 return result; 19};
You might not need to! Generally speaking, there are three environments your JavaScript code can run in:
For modern JS APIs, each environment would ideally get a polyfill:
In practice, this is hard. Tooling such as webpack and browserify are great at making sure stuff works out of the box in all environments. But it is quite easy to fail on both points above. In all likelyhood, you end up shipping less than ideal polyfills on platforms that don't even need them. So what is a developer to do? In the case of fetch
and AbortController
I've done the work for you. This is a guide to that work.
If you are building a ...
You don't need this library! AbortController
is now built into nodeJS . Use that instead.
You don't need a library! Close this tab. Uninstall this package.
Use this package and node-fetch. It is minimally what you need.
Use abort-controller and whatwg-fetch. These are more complete polyfills that will work in all browser environments.
Use abort-controller and cross-fetch. Same as above, except cross-fetch will polyfill correctly in both the browser and node.js
fetch
internallyUse this package and node-fetch. It is the smallest and least opinionated combination for your end users. Application developers targeting Internet Exploer will need to polyfill AbortController
and fetch
on their own. But your library won't be forcing unecessary polyfills on developers who only target modern browsers.
With the above guide in mind, this library has a very specific set of goals:
This is the ideal for library authors who use fetch
and AbortController
internally and target both browser and node developers.
Thank you @mysticatea for https://github.com/mysticatea/abort-controller. It is a fantastic AbortController
polyfill and ideal for many use cases.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/20 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
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
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
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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