MCPcopy Create free account
hub / github.com/anus-dev/ANUS / getJson

Function getJson

scripts/telemetry_utils.js:42–62  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

40);
41
42export function getJson(url) {
43 const tmpFile = path.join(
44 os.tmpdir(),
45 `anus-cli-releases-${Date.now()}.json`,
46 );
47 try {
48 execSync(
49 `curl -sL -H "User-Agent: anus-cli-dev-script" -o "${tmpFile}" "${url}"`,
50 { stdio: 'pipe' },
51 );
52 const content = fs.readFileSync(tmpFile, 'utf-8');
53 return JSON.parse(content);
54 } catch (e) {
55 console.error(`Failed to fetch or parse JSON from ${url}`);
56 throw e;
57 } finally {
58 if (fs.existsSync(tmpFile)) {
59 fs.unlinkSync(tmpFile);
60 }
61 }
62}
63
64export function downloadFile(url, dest) {
65 try {

Callers 1

ensureBinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected