MCPcopy
hub / github.com/ThatGuySam/doesitarm / scanFile

Method scanFile

helpers/app-files-scanner.js:395–606  ·  view source on GitHub ↗
( file, scanIndex )

Source from the content-addressed store, hash-verified

393 }
394
395 async scanFile ( file, scanIndex ) {
396
397 // If we've already scanned this
398 // then skip
399 if ( file.status === 'finished' ) return
400
401 if ( !this.isApp( file ) ) {
402 file.statusMessage = '⏭ Skipped. Not app or archive'
403 file.status = 'finished'
404
405 return
406 }
407
408 // console.log('file', file)
409
410 await new Promise(r => setTimeout(r, 1500 * scanIndex))
411
412 file.statusMessage = '🗃 Decompressing file'
413 console.log(`Decompressing file at ${ file.size }`)
414
415 let entries
416
417 try {
418 entries = await this.unzipFile( file )
419 } catch ( Error ) {
420 // console.warn( Error )
421
422 this.submitScanInfo ({
423 filename: file.name,
424 appVersion: null,
425 result: 'error_decompression_error',
426 machoMeta: null,
427 infoPlist: null
428 })
429
430 // Set status message as error
431 file.statusMessage = `❔ ${ Error.message }`
432 file.status = 'finished'
433
434 return
435 }
436
437 file.statusMessage = '👀 Scanning App Files'
438 console.log(`Searching entries`)
439
440 const foundEntries = this.findEntries( entries, {
441 macho: this.matchesMacho,
442 rootInfo: this.matchesRootInfo
443 })
444
445 // Clean out entries now that we're done with them
446 entries = undefined
447
448 // console.log('foundEntries', foundEntries)
449
450 // file.machOEntries = this.findMachOEntries( entries )
451 file.machOEntries = foundEntries.macho
452

Callers 1

scanMethod · 0.95

Calls 8

isAppMethod · 0.95
unzipFileMethod · 0.95
submitScanInfoMethod · 0.95
findEntriesMethod · 0.95
parseMachOBlobMethod · 0.95
finishFileScanMethod · 0.95

Tested by

no test coverage detected