streaming.ts — astro Source File
Architecture documentation for streaming.ts, a typescript file in the astro codebase.
Entity Profile
Relationship Graph
Source Code
export const GET = ({ locals }) => {
let sentChunks = 0;
const readableStream = new ReadableStream({
async pull(controller) {
if (sentChunks === 3) return controller.close();
else sentChunks++;
await new Promise(resolve => setTimeout(resolve, 1000));
controller.enqueue(new TextEncoder().encode('hello\n'));
},
cancel() {
locals.cancelledByTheServer = true;
}
});
return new Response(readableStream, {
headers: {
"Content-Type": "text/event-stream"
}
});
}
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does streaming.ts do?
streaming.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in streaming.ts?
streaming.ts defines 1 function(s): GET.
Where is streaming.ts in the architecture?
streaming.ts is located at packages/integrations/node/test/fixtures/api-route/src/pages/streaming.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/node/test/fixtures/api-route/src/pages).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free