Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@aws-sdk/abort-controller
Advanced tools
The @aws-sdk/abort-controller npm package provides a mechanism to abort one or more Web requests before they have completed. It is primarily used to enhance the management of API requests, particularly in environments where network requests can hang or need to be manually terminated to manage resources effectively.
Abort HTTP requests
This code sample demonstrates how to use the AbortController to abort an HTTP fetch request. The 'signal' is passed to the fetch request, and the request can be aborted by calling 'controller.abort()'.
const { AbortController } = require('@aws-sdk/abort-controller');
const controller = new AbortController();
const signal = controller.signal;
fetch('https://api.example.com/data', { signal })
.then(response => response.json())
.catch(err => {
if (err.name === 'AbortError') {
console.log('Fetch aborted');
} else {
console.error('Fetch error:', err);
}
});
// Abort the request
controller.abort();
The 'abort-controller' package provides a similar functionality to @aws-sdk/abort-controller by implementing the AbortController interface to abort fetch requests. It is widely used for managing fetch-based network requests and is compatible with the standard web API, making it a direct alternative.
The 'node-abort-controller' package is another alternative that implements the AbortController API for Node.js environments. It allows developers to abort asynchronous tasks and HTTP requests. It is similar to @aws-sdk/abort-controller but is specifically tailored for Node.js, unlike the more general-purpose @aws-sdk/abort-controller which is designed with AWS SDK integrations in mind.
3.12.0 (2021-04-09)
window
can be undefined (#2214) (98b65b9)FAQs
A simple abort controller library
The npm package @aws-sdk/abort-controller receives a total of 3,076,790 weekly downloads. As such, @aws-sdk/abort-controller popularity was classified as popular.
We found that @aws-sdk/abort-controller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.