Created
January 21, 2020 09:25
-
-
Save michaelneu/e6a75b1308bbcef6cdf6b62a16817b40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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