MCPcopy Create free account
hub / github.com/allocnode/oh-my-sage / compress

Function compress

ref/gateway_client.js:68–74  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

66
67// ==================== 压缩/解压 ====================
68function compress(data) {
69 const compressed = deflateRawSync(data);
70 const result = Buffer.alloc(4 + compressed.length);
71 result.writeUInt32LE(data.length, 0);
72 compressed.copy(result, 4);
73 return result;
74}
75
76function decompress(data) {
77 if (data.length < 4) throw new Error('Data too short');

Callers 1

callApiMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected