mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
FIx File proccessing for Browser and Node
This commit is contained in:
parent
7f9d891ab7
commit
d7112ae322
2 changed files with 25 additions and 14 deletions
|
|
@ -6,8 +6,7 @@
|
|||
import * as FileApi from '~/helpers/scanner/file-api.js'
|
||||
import { isString, isNonEmptyString } from '~/helpers/check-types.js'
|
||||
import { parsePlistBuffer } from '~/helpers/scanner/parsers/plist.js'
|
||||
// import { extractMachoMeta } from '~/helpers/scanner/parsers/macho.js'
|
||||
|
||||
import { extractMachoMeta } from '~/helpers/scanner/parsers/macho.js'
|
||||
import { Buffer } from 'buffer/'
|
||||
|
||||
// For some reason inline 'import()' works better than 'import from'
|
||||
|
|
@ -229,7 +228,7 @@ export class AppScan {
|
|||
|
||||
this.sendMessage({
|
||||
message: 'ℹ️ Found Info.plist',
|
||||
data: this.infoPlist,
|
||||
// data: this.infoPlist
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -273,19 +272,24 @@ export class AppScan {
|
|||
throw new Error( 'More than one primary Macho executable found' )
|
||||
}
|
||||
|
||||
// Get blob data from zip
|
||||
// https://gildas-lormeau.github.io/zip.js/core-api.html#zip-entry
|
||||
// Get zip as Uint8Array
|
||||
const bundleExecutableUint8Array = await this.readFileEntryData( fileEntry, zip.Uint8ArrayWriter )
|
||||
|
||||
// console.log( 'bundleExecutableBlob', bundleExecutableBlob.buffer )
|
||||
|
||||
const machoFileInstance = new FileApi.File({
|
||||
name: this.bundleExecutable.filename,
|
||||
type: 'application/x-mach-binary',
|
||||
buffer: Buffer.from( bundleExecutableUint8Array ),
|
||||
buffer: Buffer.from( bundleExecutableUint8Array )
|
||||
})
|
||||
|
||||
this.machoMeta = await extractMachoMeta({ machoFileInstance, FileApi })
|
||||
// Get zip as blob
|
||||
// so we can use it in for the File API when we're in the browser context
|
||||
// https://gildas-lormeau.github.io/zip.js/core-api.html#zip-entry
|
||||
machoFileInstance.blob = await this.readFileEntryData( fileEntry, zip.BlobWriter )
|
||||
|
||||
this.machoMeta = await extractMachoMeta({
|
||||
machoFileInstance,
|
||||
FileApi
|
||||
})
|
||||
|
||||
// console.log( 'this.machoMeta', this.machoMeta )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue