https://github.com/cameronhunter/async-with-timeout
A node utility function that implements timeout and AbortSignal support for async functions.
https://github.com/cameronhunter/async-with-timeout
Last synced: 7 months ago
JSON representation
A node utility function that implements timeout and AbortSignal support for async functions.
- Host: GitHub
- URL: https://github.com/cameronhunter/async-with-timeout
- Owner: cameronhunter
- Created: 2023-07-08T04:48:51.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-19T19:27:40.000Z (over 2 years ago)
- Last Synced: 2025-10-22T09:06:24.078Z (8 months ago)
- Language: TypeScript
- Size: 271 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# `@cameronhunter/async-with-timeout`
[](https://www.npmjs.com/package/@cameronhunter/async-with-timeout)
[](https://www.npmjs.com/package/@cameronhunter/async-with-timeout)
[](https://github.com/cameronhunter/async-with-timeout/actions/workflows/post-merge.yml)
A node utility function that implements timeout and `AbortSignal` support for async functions.
## Usage
```ts
import { withTimeout } from '@cameronhunter/async-with-timeout';
await withTimeout(5000, async () => {
const a: number = await longProcess();
const b: number = await anotherLongProcess();
return a + b;
});
```