MCPcopy Index your code
hub / github.com/MiniMax-AI/cli / verifySha256

Function verifySha256

src/update/self-update.ts:92–102  ·  view source on GitHub ↗
(filePath: string, expected: string)

Source from the content-addressed store, hash-verified

90}
91
92async function verifySha256(filePath: string, expected: string): Promise<void> {
93 const { createHash } = await import('crypto');
94 const { readFileSync } = await import('fs');
95 const actual = createHash('sha256').update(readFileSync(filePath)).digest('hex');
96 if (actual !== expected) {
97 throw new CLIError(
98 `Checksum mismatch.\n expected: ${expected}\n actual: ${actual}`,
99 ExitCode.GENERAL,
100 );
101 }
102}
103
104async function downloadFile(url: string, dest: string, onProgress?: (pct: number) => void): Promise<void> {
105 const res = await fetch(url, { signal: AbortSignal.timeout(120_000) });

Callers 1

applySelfUpdateFunction · 0.85

Calls 1

updateMethod · 0.65

Tested by

no test coverage detected