Add EncryptedFile.close method to write header info to the file_obj

pull/37/head
tuxxy 2017-09-13 15:39:07 -07:00
parent 4167ba690d
commit 6d9fdd1655
1 changed files with 8 additions and 0 deletions

View File

@ -156,3 +156,11 @@ class EncryptedFile(object):
# :param bytes data: Data to encrypt and write
#
# :return: Number of chunks written
def close(self):
"""
Writes the header to the file_obj and closes it. Called after the user
is finished writing data to the file_obj.
"""
header, header_length = self._encode_header()
self.file_obj.write(header + header_length)