mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add downloadStorkToml helper and script
This commit is contained in:
parent
e37364087a
commit
5bbbc7f41c
2 changed files with 37 additions and 0 deletions
28
helpers/api/static.js
Normal file
28
helpers/api/static.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
import axios from 'axios'
|
||||||
|
import 'dotenv/config'
|
||||||
|
|
||||||
|
import {
|
||||||
|
storkVersion,
|
||||||
|
storkExecutableName,
|
||||||
|
storkExecutablePath,
|
||||||
|
storkTomlPath,
|
||||||
|
} from '~/helpers/stork/config.js'
|
||||||
|
|
||||||
|
export async function downloadStorkToml () {
|
||||||
|
const apiUrl = new URL( process.env.PUBLIC_API_DOMAIN )
|
||||||
|
|
||||||
|
apiUrl.pathname = storkTomlPath.replace('/static', '')
|
||||||
|
|
||||||
|
console.log('apiUrl', apiUrl)
|
||||||
|
|
||||||
|
// await axios( apiUrl.toString() )
|
||||||
|
|
||||||
|
|
||||||
|
axios({
|
||||||
|
method: "get",
|
||||||
|
url: apiUrl.toString(),
|
||||||
|
responseType: "stream"
|
||||||
|
}).then(function (response) {
|
||||||
|
response.data.pipe(fs.createWriteStream( storkTomlPath ))
|
||||||
|
})
|
||||||
|
}
|
||||||
9
scripts/download-stork-toml.js
Normal file
9
scripts/download-stork-toml.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import {
|
||||||
|
downloadStorkToml
|
||||||
|
} from '~/helpers/api/static.js'
|
||||||
|
|
||||||
|
;(async () => {
|
||||||
|
await downloadStorkToml()
|
||||||
|
|
||||||
|
process.exit()
|
||||||
|
})()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue