* Bump version to 0.0.2-alpha: File Base alpha here

* LHA/LZH archive support via external lha command
* Nearly complete upload processor
* Set default file base filter if none is set
* Additional MenuModule common method/helpers
* MLTEV property: tabSwitchesView
This commit is contained in:
Bryan Ashby 2017-01-22 21:30:49 -07:00
parent 8d51c7d47c
commit 99036592ae
14 changed files with 269 additions and 109 deletions

View file

@ -294,6 +294,10 @@ function populateFileEntryWithArchive(fileEntry, filePath, stepInfo, iterator, c
extractList.push(longDescFile.fileName);
}
if(0 === extractList.length) {
return callback(null, [] );
}
temp.mkdir('enigextract-', (err, tempDir) => {
if(err) {
return callback(err);
@ -423,6 +427,9 @@ function scanFile(filePath, options, iterator, cb) {
});
}
let lastCalcHashPercent;
async.waterfall(
[
function startScan(callback) {
@ -449,25 +456,39 @@ function scanFile(filePath, options, iterator, cb) {
const stream = fs.createReadStream(filePath);
function updateHashes(data) {
async.each( HASH_NAMES, (hashName, nextHash) => {
hashes[hashName].update(data);
return nextHash(null);
}, () => {
return stream.resume();
});
}
stream.on('data', data => {
stream.pause(); // until iterator compeltes
stepInfo.bytesProcessed += data.length;
stepInfo.step = 'hash_update';
stepInfo.bytesProcessed += data.length;
stepInfo.calcHashPercent = Math.round(((stepInfo.bytesProcessed / stepInfo.byteSize) * 100));
callIter(err => {
if(err) {
stream.destroy(); // cancel read
return callback(err);
}
//
// Only send 'hash_update' step update if we have a noticable percentage change in progress
//
if(stepInfo.calcHashPercent === lastCalcHashPercent) {
updateHashes(data);
} else {
lastCalcHashPercent = stepInfo.calcHashPercent;
stepInfo.step = 'hash_update';
async.each( HASH_NAMES, (hashName, nextHash) => {
hashes[hashName].update(data);
return nextHash(null);
}, () => {
return stream.resume();
callIter(err => {
if(err) {
stream.destroy(); // cancel read
return callback(err);
}
updateHashes(data);
});
});
}
});
stream.on('end', () => {