MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / serveOnce

Function serveOnce

packages/agent-core/test/plugin/archive.test.ts:82–95  ·  view source on GitHub ↗
(buffer: Buffer)

Source from the content-addressed store, hash-verified

80}
81
82async function serveOnce(buffer: Buffer): Promise<string> {
83 const { createServer } = await import('node:http');
84 return new Promise((resolve) => {
85 const server = createServer((_, res) => {
86 res.writeHead(200, { 'Content-Type': 'application/zip' });
87 res.end(buffer);
88 server.close();
89 });
90 server.listen(0, '127.0.0.1', () => {
91 const addr = server.address()!;
92 resolve(`http://127.0.0.1:${(addr as any).port}`);
93 });
94 });
95}
96
97describe('downloadZip', () => {
98 it('downloads a zip from a URL', async () => {

Callers 1

archive.test.tsFile · 0.70

Calls 4

closeMethod · 0.65
listenMethod · 0.65
resolveFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected