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

Function createZipBuffer

packages/agent-core/test/plugin/manager.test.ts:1024–1038  ·  view source on GitHub ↗
(entries: Array<{ name: string; data: string | Buffer }>)

Source from the content-addressed store, hash-verified

1022}
1023
1024async function createZipBuffer(entries: Array<{ name: string; data: string | Buffer }>): Promise<Buffer> {
1025 return new Promise((resolve, reject) => {
1026 const zipfile = new yazl.ZipFile();
1027 const chunks: Buffer[] = [];
1028 zipfile.outputStream.on('data', (chunk) => chunks.push(chunk));
1029 zipfile.outputStream.on('end', () => {
1030 resolve(Buffer.concat(chunks));
1031 });
1032 zipfile.outputStream.on('error', reject);
1033 for (const entry of entries) {
1034 zipfile.addBuffer(Buffer.isBuffer(entry.data) ? entry.data : Buffer.from(entry.data), entry.name);
1035 }
1036 zipfile.end();
1037 });
1038}
1039
1040async function serveOnce(buffer: Buffer): Promise<string> {
1041 const { createServer } = await import('node:http');

Callers 1

manager.test.tsFile · 0.70

Calls 4

onMethod · 0.65
resolveFunction · 0.50
pushMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected