Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/hono/dist/helper/streaming/stream.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 808 Bytes
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/helper/streaming/stream.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/hono/dist/helper/streaming/stream.js
-
curl -L -o stream.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/helper/streaming/stream.js
808 Bytes
| import { StreamingApi } from "../../utils/stream.js"; | |
| import { isOldBunVersion } from "./utils.js"; | |
| //#region src/helper/streaming/stream.ts | |
| const contextStash = /* @__PURE__ */ new WeakMap(); | |
| const stream = (c, cb, onError) => { | |
| const { readable, writable } = new TransformStream(); | |
| const stream = new StreamingApi(writable, readable); | |
| if (isOldBunVersion()) c.req.raw.signal.addEventListener("abort", () => { | |
| if (!stream.closed) stream.abort(); | |
| }); | |
| contextStash.set(stream.responseReadable, c); | |
| (async () => { | |
| try { | |
| await cb(stream); | |
| } catch (e) { | |
| if (e === void 0) {} else if (e instanceof Error && onError) await onError(e, stream); | |
| else console.error(e); | |
| } finally { | |
| stream.close(); | |
| } | |
| })(); | |
| return c.newResponse(stream.responseReadable); | |
| }; | |
| //#endregion | |
| export { stream }; | |