let imports = {}; imports['__wbindgen_placeholder__'] = module.exports; let wasm; const { TextDecoder, TextEncoder } = require(`util`); let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); let cachedUint8Memory0; function getUint8Memory0() { if (cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8Memory0; } function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } const heap = new Array(32).fill(undefined); heap.push(undefined, null, true, false); let heap_next = heap.length; function addHeapObject(obj) { if (heap_next === heap.length) heap.push(heap.length + 1); const idx = heap_next; heap_next = heap[idx]; heap[idx] = obj; return idx; } function getObject(idx) { return heap[idx]; } function dropObject(idx) { if (idx < 36) return; heap[idx] = heap_next; heap_next = idx; } function takeObject(idx) { const ret = getObject(idx); dropObject(idx); return ret; } let WASM_VECTOR_LEN = 0; function passArray8ToWasm0(arg, malloc) { const ptr = malloc(arg.length * 1); getUint8Memory0().set(arg, ptr / 1); WASM_VECTOR_LEN = arg.length; return ptr; } let cachedInt32Memory0; function getInt32Memory0() { if (cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } return cachedInt32Memory0; } /** * @param {Uint8Array} data * @returns {BinaryInfo} */ module.exports.detect = function(data) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.detect(retptr, ptr0, len0); var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; var r2 = getInt32Memory0()[retptr / 4 + 2]; if (r2) { throw takeObject(r1); } return BinaryInfo.__wrap(r0); } finally { wasm.__wbindgen_add_to_stack_pointer(16); } }; function isLikeNone(x) { return x === undefined || x === null; } let cachedTextEncoder = new TextEncoder('utf-8'); const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' ? function (arg, view) { return cachedTextEncoder.encodeInto(arg, view); } : function (arg, view) { const buf = cachedTextEncoder.encode(arg); view.set(buf); return { read: arg.length, written: buf.length }; }); function passStringToWasm0(arg, malloc, realloc) { if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); const ptr = malloc(buf.length); getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; let ptr = malloc(len); const mem = getUint8Memory0(); let offset = 0; for (; offset < len; offset++) { const code = arg.charCodeAt(offset); if (code > 0x7F) break; mem[ptr + offset] = code; } if (offset !== len) { if (offset !== 0) { arg = arg.slice(offset); } ptr = realloc(ptr, len, len = offset + arg.length * 3); const view = getUint8Memory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); offset += ret.written; } WASM_VECTOR_LEN = offset; return ptr; } /** */ module.exports.Runtime = Object.freeze({ Go:0,"0":"Go",Rust:1,"1":"Rust", }); /** */ module.exports.Platform = Object.freeze({ Win32:0,"0":"Win32",Darwin:1,"1":"Darwin",Linux:2,"2":"Linux", }); /** */ module.exports.Arch = Object.freeze({ X86:0,"0":"X86",Amd64:1,"1":"Amd64",Arm:2,"2":"Arm",Arm64:3,"3":"Arm64", }); /** */ class BinaryInfo { static __wrap(ptr) { const obj = Object.create(BinaryInfo.prototype); obj.ptr = ptr; return obj; } __destroy_into_raw() { const ptr = this.ptr; this.ptr = 0; return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_binaryinfo_free(ptr); } /** */ get platform() { const ret = wasm.__wbg_get_binaryinfo_platform(this.ptr); return ret >>> 0; } /** */ set platform(arg0) { wasm.__wbg_set_binaryinfo_platform(this.ptr, arg0); } /** */ get arch() { const ret = wasm.__wbg_get_binaryinfo_arch(this.ptr); return ret >>> 0; } /** */ set arch(arg0) { wasm.__wbg_set_binaryinfo_arch(this.ptr, arg0); } /** */ get runtime() { const ret = wasm.__wbg_get_binaryinfo_runtime(this.ptr); return ret === 2 ? undefined : ret; } /** */ set runtime(arg0) { wasm.__wbg_set_binaryinfo_runtime(this.ptr, isLikeNone(arg0) ? 2 : arg0); } } module.exports.BinaryInfo = BinaryInfo; module.exports.__wbindgen_string_new = function(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); return addHeapObject(ret); }; module.exports.__wbg_new_693216e109162396 = function() { const ret = new Error(); return addHeapObject(ret); }; module.exports.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) { const ret = getObject(arg1).stack; const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; }; module.exports.__wbg_error_09919627ac0992f5 = function(arg0, arg1) { try { console.error(getStringFromWasm0(arg0, arg1)); } finally { wasm.__wbindgen_free(arg0, arg1); } }; module.exports.__wbindgen_object_drop_ref = function(arg0) { takeObject(arg0); }; module.exports.__wbindgen_throw = function(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; const path = require('path').join(__dirname, 'binary_info_bg.wasm'); const bytes = require('fs').readFileSync(path); const wasmModule = new WebAssembly.Module(bytes); const wasmInstance = new WebAssembly.Instance(wasmModule, imports); wasm = wasmInstance.exports; module.exports.__wasm = wasm; cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);