Skip to content
Snippets Groups Projects
Commit ef860208 authored by Josefine Wegert's avatar Josefine Wegert
Browse files

downloader works with each alone and both together

parent 40a821cc
No related branches found
No related tags found
No related merge requests found
......@@ -174,7 +174,10 @@ function streamFilesToZip(){
backendContent = fs.readFileAsync(file.path);
backendContent.then(function(data){
addBackendToZip(data).then(function(){
resolve(finishedArray.push('backend finished'));
finishedArray.push('backend finished');
if(finishedArray.length === promiseArray.length){
resolve(zip);
}
})
......@@ -193,7 +196,10 @@ function streamFilesToZip(){
}).on('finish', function(){
console.log('zip in frontend:', zip);
resolve(finishedArray.push('frontend finished'));
finishedArray.push('frontend finished');
if(finishedArray.length === promiseArray.length){
resolve(zip);
}
console.log('finishedArray in frontend:', finishedArray);
......@@ -213,24 +219,10 @@ function streamFilesToZip(){
})
}
function collectFilesToZip(finishedArray){
console.log('in collectFilesToZip');
console.log('finishedArray.length:', finishedArray.length);
console.log('promiseArray.length:', promiseArray.length);
return new Promise((resolve,reject)=> {
if(finishedArray.length === promiseArray.length){
console.log('in resolve()');
resolve(zip);
}
})
}
function finalizeZip(){
return streamFilesToZip().then(function(){
return collectFilesToZip(finishedArray).then(function(zip){
return streamFilesToZip().then(function(zip){
return createZip(zip)
})
}).catch(function(error) {let response =
'There was an error during your build. ' +
'Please contact "explorviz-developers-request@listserv.dfn.de" ' +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment