()
| 10 | import { getText } from '~/helpers/http.js' |
| 11 | |
| 12 | export 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 | } |
no test coverage detected