# @azure/abort-controller

> Microsoft Azure SDK for JavaScript - Aborter

Latest version **2.2.0** (published 2026-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @azure/abort-controller
pnpm add @azure/abort-controller
yarn add @azure/abort-controller
bun add @azure/abort-controller
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-07-13 |
| First published | 2019-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.0.0 |
| Dependencies | 1 |
| Unpacked size | 31.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2296 |
| Author | Microsoft Corporation |
| Maintainers | azure-sdk, microsoft1es, microsoft-oss-releases |
| Keywords | azure, aborter, abortsignal, cancellation, node.js, typescript, javascript, browser, cloud |

## Links

- npm: https://www.npmjs.com/package/@azure/abort-controller
- Repository: https://github.com/Azure/azure-sdk-for-js
- Homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md
- Issues: https://github.com/Azure/azure-sdk-for-js/issues
- npm.io page: https://npm.io/package/@azure/abort-controller

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2026-07-13
- 2.1.3-alpha.20260306.4 (dev) — 2026-03-06
- 2.1.3-alpha.20260305.6 — 2026-03-05
- 2.1.3-alpha.20260227.2 — 2026-02-27
- 2.1.3-alpha.20260226.1 — 2026-02-26
- 2.1.3-alpha.20260224.3 — 2026-02-24
- 2.1.3-alpha.20260223.3 — 2026-02-23
- 2.1.3-alpha.20260220.1 — 2026-02-20
- 2.1.3-alpha.20260219.1 — 2026-02-19
- 2.1.3-alpha.20260216.1 — 2026-02-16
- 2.1.3-alpha.20260213.2 — 2026-02-13
- 2.1.3-alpha.20260210.1 — 2026-02-10
- 2.1.3-alpha.20260204.2 — 2026-02-04
- 2.1.3-alpha.20260203.2 — 2026-02-03
- 2.1.3-alpha.20260126.3 — 2026-01-26
- … 521 more at https://npm.io/package/@azure/abort-controller/versions

## README

# Azure Abort Controller client library for JavaScript

The `@azure/abort-controller` package provides `AbortSignalLike` interface and
`AbortError` classes to make it easier to work with the
[AbortController](https://developer.mozilla.org/docs/Web/API/AbortController)
and the `AbortSignal` used by
[fetch](https://developer.mozilla.org/docs/Web/API/Fetch_API) built into modern JavaScript platforms.

Customers of Azure SDK for JavaScript in general do not need to use this library. Instead they
use `AbortController` and `AbortSignal` provided by their platforms and pass the abort signals to Azure SDK operations.

Key links:

- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller)
- [Package (npm)](https://www.npmjs.com/package/@azure/abort-controller)
- [API Reference Documentation](https://learn.microsoft.com/javascript/api/overview/azure/abort-controller-readme)

## Getting started

### Installation

Install this library using npm as follows

```
npm install @azure/abort-controller
```

## Key Concepts

Use `AbortController` to create an `AbortSignal` which can then be passed to Azure SDK operations to cancel
pending work. The `AbortSignal` can be accessed via the `signal` property on an instantiated `AbortController`.
An `AbortSignal` can also be returned directly from a static method, e.g. `AbortSignal.timeout(100)`.
that is cancelled after 100 milliseconds.

## Examples

The below examples assume that `doAsyncWork` is a function that takes a bag of properties, one of which is
of the abort signal.

### Example 1 - basic usage

```ts snippet:ReadmeSampleBasicUsage
async function doAsyncWork(options: { abortSignal: AbortSignal }): Promise<void> {
  if (options.abortSignal.aborted) {
    return;
  }

  // do async work
}

const controller = new AbortController();
doAsyncWork({ abortSignal: controller.signal });

// at some point later
controller.abort();
```

### Example 2 - Aborting with timeout

```ts snippet:ReadmeSampleBasicTimeout
async function doAsyncWork(options: { abortSignal: AbortSignal }): Promise<void> {
  if (options.abortSignal.aborted) {
    return;
  }

  // do async work
}

const signal = AbortSignal.timeout(1000);
doAsyncWork({ abortSignal: signal });
```

## Next steps

You can build and run the tests locally by executing `npm run test`. Explore the `test` folder to see advanced usage and behavior of the public classes.

## Troubleshooting

If you run into issues while using this library, please feel free to [file an issue](https://github.com/Azure/azure-sdk-for-js/issues/new).

## Contributing

If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.

---
_Source: https://npm.io/package/@azure/abort-controller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
