Spaces:
Running
Running
Download shared/withTimeout.ts from Felladrin/MiniSearch: direct link, hf CLI and curl.
- Browser
- Download file 289 Bytes
-
https://huggingface.co/spaces/Felladrin/MiniSearch/resolve/main/shared/withTimeout.ts
- Command line
-
hf download hf://spaces/Felladrin/MiniSearch/shared/withTimeout.ts
-
curl -L -o withTimeout.ts https://huggingface.co/spaces/Felladrin/MiniSearch/resolve/main/shared/withTimeout.ts
289 Bytes
| /** Aborts when `signal` does, or after `ms` milliseconds, whichever comes first. */ | |
| export function withTimeout( | |
| signal: AbortSignal | undefined, | |
| ms: number, | |
| ): AbortSignal { | |
| const timeout = AbortSignal.timeout(ms); | |
| return signal ? AbortSignal.any([signal, timeout]) : timeout; | |
| } | |