async function getBackupTemplate(shipKey, historyLogBlobDirectory, reportDataBlobDirectory) {
const historyLogStreamPath = `${window.remote.app.getPath('userData')}/backupStream1.txt`;
const reportDataStreamPath = `${window.remote.app.getPath('userData')}/backupStream2.txt`;
const historyLog = await new Promise((resolve, reject) => {
const stream = fs.createWriteStream(historyLogStreamPath);
let historySummary = window.blobService.getBlobToStream(window.containerName, historyLogBlobDirectory, stream, async (err, text) => {
console.log(historyLogStreamPath)
console.log('historySummary1', historySummary)
if (err) {
if (err.statusCode === 403) {
azureCustomService.setRequestDateHeaderFromAzureServerTimeStamp(err.message);
await azureCustomService.communicateAzureWithCustomHeader('GET', window.containerName, historyLogBlobDirectory);
try {
azureCustomService.streamParsingToJSON(historyLogStreamPath, (err, data) => {
resolve(JSON.parse(data));
});
} catch (e) {
reject(e);
}
}
} else {
console.log('comp history', text)
azureCustomService.streamParsingToJSON(historyLogStreamPath, (err, data) => {
resolve(JSON.parse(data));
});
}
});
console.log('historySummary2', historySummary)
historySummary.on('progress', function() {
var percentComplete = historySummary.getCompletePercent(2);
var totalSize = historySummary.getTotalSize(true);
console.log('Upload Complete3' + percentComplete);
console.log('total: ' + totalSize);
});
});
----result----
Upload Complete3 (%): 100.00
total: 4.61KB
I want get download progress realtime
but it coming only one time after connection complete.
How can I make ??