MCPcopy Index your code
hub / github.com/craftreactnative/ui / cleanup

Function cleanup

cli/src/utils/github-downloader.ts:36–46  ·  view source on GitHub ↗

* Cleans up resources (file, response, request)

(
  file: fs.WriteStream | null,
  response: http.IncomingMessage | null,
  request: http.ClientRequest | null,
  tempPath: string
)

Source from the content-addressed store, hash-verified

34 * Cleans up resources (file, response, request)
35 */
36function cleanup(
37 file: fs.WriteStream | null,
38 response: http.IncomingMessage | null,
39 request: http.ClientRequest | null,
40 tempPath: string
41): void {
42 if (file) file.close();
43 if (response) response.destroy();
44 if (request) request.destroy();
45 if (fs.existsSync(tempPath)) fs.unlinkSync(tempPath);
46}
47
48/**
49 * Checks if cache is stale based on timestamp (1 day)

Callers 1

downloadFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected