User local MachoNode

This commit is contained in:
Sam Carlton 2022-07-19 22:27:37 -05:00
parent 5bce0c5dc3
commit c04da29933

View file

@ -1,5 +1,7 @@
import bufferApi from 'buffer' import bufferApi from 'buffer'
import { Parser as MachoNodeParser } from './macho-node/parser.js'
function makeFileBuffer ( buffer ) { function makeFileBuffer ( buffer ) {
const fileBuffer = new bufferApi.Buffer.alloc( buffer.byteLength ) const fileBuffer = new bufferApi.Buffer.alloc( buffer.byteLength )
@ -9,6 +11,8 @@ function makeFileBuffer ( buffer ) {
return fileBuffer return fileBuffer
} }
const machoNodeParser = new MachoNodeParser()
// Tends to not support universal architecture // Tends to not support universal architecture
// but support some MachoManiac doesn't and fails faster // but support some MachoManiac doesn't and fails faster
// so we run it first // so we run it first
@ -61,7 +65,8 @@ export class MachoNode {
} }
async run () { async run () {
const { parse } = await import( 'macho' )
// console.log( 'machoNodeParser', machoNodeParser )
const machoNodeMeta = machoNodeParser.execute( makeFileBuffer( this.machoFileInstance.buffer ) ) const machoNodeMeta = machoNodeParser.execute( makeFileBuffer( this.machoFileInstance.buffer ) )