Wait for toml file to write

This commit is contained in:
Sam Carlton 2022-05-10 12:15:58 -05:00
parent eaf500e061
commit 01e8db4a78

View file

@ -19,14 +19,13 @@ export async function downloadStorkToml () {
// await axios( apiUrl.toString() )
await axios({
const response = await axios({
method: "get",
url: apiUrl.toString(),
responseType: "stream"
}).then(function (response) {
response.data.pipe(fs.createWriteStream( storkTomlPath ))
})
await fs.writeFile( storkTomlPath, response.data, { encoding: null })
// Get toml file stats
const stats = await fs.stat( storkTomlPath )
console.log('TOML Stats', storkTomlPath, stats)