Spaces:
Runtime error
Runtime error
Download apps/webapp/app/services/httpAsyncStorage.server.ts from BTankut/Context-Store-LLM: direct link, hf CLI and curl.
- Browser
- Download file 559 Bytes
-
https://huggingface.co/spaces/BTankut/Context-Store-LLM/resolve/main/apps/webapp/app/services/httpAsyncStorage.server.ts
- Command line
-
hf download hf://spaces/BTankut/Context-Store-LLM/apps/webapp/app/services/httpAsyncStorage.server.ts
-
curl -L -o httpAsyncStorage.server.ts https://huggingface.co/spaces/BTankut/Context-Store-LLM/resolve/main/apps/webapp/app/services/httpAsyncStorage.server.ts
559 Bytes
| import { AsyncLocalStorage } from "node:async_hooks"; | |
| export type HttpLocalStorage = { | |
| requestId: string; | |
| path: string; | |
| host: string; | |
| method: string; | |
| }; | |
| const httpLocalStorage = new AsyncLocalStorage<HttpLocalStorage>(); | |
| export type RunWithHttpContextFunction = <T>(context: HttpLocalStorage, fn: () => T) => T; | |
| export function runWithHttpContext<T>(context: HttpLocalStorage, fn: () => T): T { | |
| return httpLocalStorage.run(context, fn); | |
| } | |
| export function getHttpContext(): HttpLocalStorage | undefined { | |
| return httpLocalStorage.getStore(); | |
| } | |