Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
filename = sys.argv[1] if len(sys.argv) == 2 else "main.wasm"
print("[*] Reading", filename)
with open(filename, "rb") as content_fh:
content = content_fh.read()
print("[*] Generating header from %d wasm bytes" % len(content))
with open("../include/test.hpp", "w") as out_fh:
wasm_bytes = ", ".join([hex(byte) for byte in content])
out_fh.write("char wasm_test_bytes[] = { %s };" % wasm_bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment