add tool to hardcode files

This commit is contained in:
Dmitry Belyaev 2024-03-27 16:10:31 +03:00
parent 5b3ae56020
commit cdce544995

21
hardcfiles.py Normal file
View File

@ -0,0 +1,21 @@
import pickle
import base64
import sys
import zlib
files = {}
for name in sys.argv[1:]:
name = name.replace("\\", "/")
if name.startswith("./"):
name = name[2:]
with open(name, "rb") as f:
data = f.read()
files[name] = data
data = pickle.dumps(files)
compressed_data = zlib.compress(data, 9)
print(base64.b85encode(compressed_data).decode("ascii"))