Quote:
Originally Posted by sherbee
Have idea how make distinguish between manual and automatical extract?
|
You can modify the code to also get file paths of archives with links:
Code:
var getArchiveFiles = function() {
return archive.getExtractionLog().match(/\((DownloadLink|File)ArchiveFile\)File:[^|]+/g).map(function(string) {
return string.replace(/.+?:(.+)/, "$1");
});
}
Or use it with existing archive methods:
Code:
var getArchiveFiles = function() {
var archiveLinks = archive.getDownloadLinks();
if (archiveLinks) {
return archiveLinks.map(function(link) {
return link.getDownloadPath();
})
} else {
return archive.getExtractionLog().match(/\(FileArchiveFile\)File:[^|]+/g).map(function(string) {
return string.replace(/.+?:(.+)/, "$1");
});
}
}
Common usage for both functions:
Code:
getArchiveFiles().forEach(function(file) {
// Do something with each archive file
// alert(file);
});