MCPcopy
hub / github.com/ThatGuySam/doesitarm / downloadStorkToml

Function downloadStorkToml

helpers/api/static.js:12–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10import { getText } from '~/helpers/http.js'
11
12export async function downloadStorkToml () {
13 // Check if the toml file exists
14 if (fs.existsSync(storkTomlPath)) {
15 console.log(`Stork toml file already exists at ${storkTomlPath}`)
16 return
17 }
18
19 const apiUrl = new URL( process.env.PUBLIC_API_DOMAIN )
20
21 apiUrl.pathname = storkTomlPath.replace('static/', '')
22
23 const storkToml = await getText( apiUrl.toString() )
24
25 await fs.writeFile( storkTomlPath, storkToml, { encoding: null })
26
27 // Get toml file stats
28 const stats = await fs.stat( storkTomlPath )
29 console.log( stats.isFile() ? '✅' : '❌', 'TOML is file', storkTomlPath )
30 // console.log('TOML Stats', stats)
31}

Callers 1

Calls 1

getTextFunction · 0.90

Tested by

no test coverage detected