diff --git a/package-lock.json b/package-lock.json
index e2f9bb3..977711e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,8 @@
"license": "GPL-3.0-or-later",
"dependencies": {
"browser-fs-access": "^0.35.0",
- "dotenv": "^16.4.5"
+ "dotenv": "^16.4.5",
+ "filereader": "^0.10.3"
},
"devDependencies": {
"electron": "^28.2.3",
@@ -1963,6 +1964,11 @@
"minimatch": "^5.0.1"
}
},
+ "node_modules/filereader": {
+ "version": "0.10.3",
+ "resolved": "https://registry.npmjs.org/filereader/-/filereader-0.10.3.tgz",
+ "integrity": "sha512-7F8w6GSXuHLN80ukaVOcHgBaiTRHUZr8GeEhNdqfAECcnBoROg4i8hTl+KqtF4yUPffOJVHEFg4iDJb7xIYFng=="
+ },
"node_modules/foreground-child": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
diff --git a/package.json b/package.json
index 8b492ce..cccea26 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
},
"dependencies": {
"browser-fs-access": "^0.35.0",
- "dotenv": "^16.4.5"
+ "dotenv": "^16.4.5",
+ "filereader": "^0.10.3"
}
}
diff --git a/workflows/energy_plus/module/module.js b/workflows/energy_plus/module/module.js
index 7b99684..93f923d 100644
--- a/workflows/energy_plus/module/module.js
+++ b/workflows/energy_plus/module/module.js
@@ -1,12 +1,9 @@
const { dialog, BrowserWindow } = require('electron')
const fs = require('fs')
-const { fileOpen, directoryOpen, fileSave, supported } = require('browser-fs-access')
const { Blob } = require('buffer')
const dotenv = require('dotenv')
const session_start = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/session/start'
-//const energy_plus = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/workflow/energy-plus'
-const energy_plus = 'http://172.16.252.117:15789/v1.4/workflow/energy-plus'
-
+const energy_plus = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/workflow/energy-plus'
exports.run = async (application, param, tmp_path) => {
console.log(`Executing ${application}`)
@@ -50,9 +47,13 @@ exports.run = async (application, param, tmp_path) => {
var error = ''
if (response.status == 200) {
var blob = await response.blob()
- await fileSave(blob, 'test.zip', ['.zip'])
- console.log(file)
- BrowserWindow.fromId(1).webContents.send('task-completed', 'meb')
+ const buffer = Buffer.from(await blob.arrayBuffer())
+ require("fs").writeFile(
+ `${tmp_path}energyplus_results.zip`,
+ buffer,
+ (err) => { console.log(err ? err : 'energy+ zip saved'); }
+ )
+ BrowserWindow.fromId(1).webContents.send('task-completed', 'Energy plus results')
return
}
else if (response.status == 400) {
diff --git a/workflows/energy_plus/run.js b/workflows/energy_plus/run.js
index e3517ec..2f6f3f3 100644
--- a/workflows/energy_plus/run.js
+++ b/workflows/energy_plus/run.js
@@ -31,5 +31,6 @@ async function runWorkflow() {
}
}
window.functions.onTaskCompleted((value) => {
+ console.log(typeof(value))
document.getElementById('links').innerHTML = value
})
\ No newline at end of file