Commit cdf5d997 authored by Luciano Cauzzi's avatar Luciano Cauzzi

added method

parent 2ecac110
import base64
import os
from shutil import rmtree
from shutil import copy2, Error
......@@ -199,3 +200,14 @@ def crc(file_name):
for eachLine in open(file_name, "rb"):
prev = zlib.crc32(eachLine, prev)
return "%X" % (prev & 0xFFFFFFFF)
def encode_file_base64(file_path):
try:
with open(file_path, "rb") as f:
content = f.read()
encoded = base64.b64encode(content)
return encoded.decode("utf-8")
except Exception as e:
logger.error("Error while encoding {} to base 64".format(file_path))
logger.exception(e)
......@@ -3,7 +3,7 @@ import setuptools
setup(
name='file_manager',
version='0.1.13',
version='0.1.14',
packages=setuptools.find_packages(),
dependency_links=['http://github.comune.brescia.it/innovation-that-excites/logger_library#egg=logger_library'],
install_requires=['setuptools', 'logger_library'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment