From 01e8db4a788e33dac87c0999e2b29df33487d7bf Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 10 May 2022 12:15:58 -0500 Subject: [PATCH] Wait for toml file to write --- helpers/api/static.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helpers/api/static.js b/helpers/api/static.js index 4972d6e..5c332e4 100644 --- a/helpers/api/static.js +++ b/helpers/api/static.js @@ -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)