Browse Source

refactor load_as_base64, change return value type from str to bytes

quarrying 2 years ago
parent
commit
b44b503ee9
1 changed files with 2 additions and 3 deletions
  1. 2 3
      khandy/utils_file_io.py

+ 2 - 3
khandy/utils_file_io.py

@@ -43,10 +43,9 @@ def save_json(filename, data, encoding='utf-8', indent=4, cls=None, sort_keys=Fa
                   ensure_ascii=False, cls=cls, sort_keys=sort_keys)
 
 
-def load_as_base64(filename: str) -> str:
+def load_as_base64(filename: str) -> bytes:
     with open(filename, 'rb') as f:
         raw_bytes = f.read()
     b64_bytes = base64.b64encode(raw_bytes)
-    b64_str = b64_bytes.decode()
-    return b64_str
+    return b64_bytes