Skip to content

cameronhunter/async-with-timeout

Repository files navigation

@cameronhunter/async-with-timeout

npm package npm downloads main branch status

A node utility function that implements timeout and AbortSignal support for async functions.

Usage

import { withTimeout } from '@cameronhunter/async-with-timeout';

await withTimeout(5000, async () => {
    const a: number = await longProcess();
    const b: number = await anotherLongProcess();

    return a + b;
});

About

A node utility function that implements timeout and AbortSignal support for async functions.

Resources

Stars

Watchers

Forks