I am using deasync module to make functions synchronized in Node.js. But program takes more time to finish. However data is returned quickly to console.
var storeintodrive = function moveFileTo (filename){
var hash;
var sync = true
//do some operation
hash = XXXXXXXXXXXXX
sync = false;
while (sync) {
require('deasync').sleep(10);
}
return hash;
}
var hexifydata = function(array,filedata){
var sync = true;
// do some opration
Records.push(record[0]);
sync = false;
while (sync) {
require('deasync').sleep(10);
}
return Records;
}
Due to late in response from these functions,frond end JS is not getting correct response from NodeJs. Please suggest me how do I get response faster from both functions.