( fileList )
| 606 | } |
| 607 | |
| 608 | async scan ( fileList ) { |
| 609 | |
| 610 | // Push files to our files array |
| 611 | Array.from(fileList).forEach( (fileInstance, scanIndex) => { |
| 612 | this.files.unshift( { |
| 613 | status: 'loaded', |
| 614 | displayName: null, |
| 615 | statusMessage: '⏳ File Loaded and Qeued', |
| 616 | details: [], |
| 617 | appVersion: null, |
| 618 | displayAppSize: prettyBytes( fileInstance.size ), |
| 619 | displayBinarySize: null, |
| 620 | binarySize: null, |
| 621 | |
| 622 | name: fileInstance.name, |
| 623 | size: fileInstance.size, |
| 624 | type: fileList.item( scanIndex ).type, |
| 625 | lastModifiedDate: fileInstance.lastModifiedDate, |
| 626 | instance: fileInstance, |
| 627 | item: fileList.item( scanIndex ) |
| 628 | } ) |
| 629 | }) |
| 630 | |
| 631 | const scanTimeoutSeconds = 60 |
| 632 | |
| 633 | // Scan for archives |
| 634 | await Promise.all( this.files.map( ( file, scanIndex ) => { |
| 635 | return new Promise( async (resolve, reject) => { |
| 636 | |
| 637 | const timer = setTimeout(() => { |
| 638 | file.statusMessage = '❔ Scan timed out' |
| 639 | file.status = 'finished' |
| 640 | |
| 641 | reject(new Error('Scan timed out')) |
| 642 | }, scanTimeoutSeconds * 1000) |
| 643 | |
| 644 | console.log( 'Scanning', file.name ) |
| 645 | |
| 646 | console.log( 'scannerVersion', scannerVersion ) |
| 647 | |
| 648 | if ( scannerVersion === '2' ) { |
| 649 | try { |
| 650 | const { scan } = await runScanWorker( file.instance, messageDetails => { |
| 651 | console.log( 'messageDetails', messageDetails ) |
| 652 | |
| 653 | if ( isString( messageDetails.message ) ) { |
| 654 | file.statusMessage = messageDetails.message |
| 655 | } |
| 656 | |
| 657 | if ( isString( messageDetails.status ) ) { |
| 658 | file.status = messageDetails.status |
| 659 | } |
| 660 | } ) |
| 661 | |
| 662 | this.applyWorkerScanData( file, scan ) |
| 663 | |
| 664 | const { supportedVersionNumber } = await this.submitScanInfo({ |
| 665 | filename: scan.info?.filename || file.name, |
nothing calls this directly
no test coverage detected