(input_file, output_file, function_name)
| 21 | |
| 22 | |
| 23 | def prepare_wasm(input_file, output_file, function_name): |
| 24 | # Read the compiled WASM as binary and convert to hex |
| 25 | wasm_bytes = Path(input_file).read_bytes() |
| 26 | |
| 27 | hex_string = "".join(f"{byte:02x}" for byte in wasm_bytes) |
| 28 | |
| 29 | # Generate JavaScript module |
| 30 | js_content = JS_TEMPLATE.format( |
| 31 | function_name=function_name, hex_string=hex_string |
| 32 | ) |
| 33 | Path(output_file).write_text(js_content) |
| 34 | |
| 35 | print(f"Successfully compiled {input_file} and generated {output_file}") |
| 36 | return 0 |
| 37 | |
| 38 | |
| 39 | def main(): |
no test coverage detected
searching dependent graphs…