- # break when there is no more data left
- if len(buf) == 0:
- break
-
- # update the md5 hash object
- digestor.update(buf)
-
- # Get the final hash code
- hexdigest = digestor.hexdigest()
-
- # Get the file name from the StreamFileReader object
- file_name = input_file.name()
-
- # The "stream name" is the subdirectory inside the collection in which
- # the file is located; '.' is the root of the collection.
- if input_file.stream_name() != '.':
- file_name = os.join(input_file.stream_name(), file_name)