def write(self, data):
"""
Write data to multiple clouds.
Uses a write-through buffer to ensure each chunk is the proper size.
Close flushes the remainder of the buffer.
"""
if self._closed:
raise IOError('I/O operation on closed file.')
if self._size == 0:
# First block. See if we can get a more specific mime type by
# examining the data.
mime = magic.from_buffer(data, mime=True)
# Choose the better mimetype somehow, self.mime is determined by
# the filename. mime is determined by magic.
if not self.mime or mime != 'application/octet-strem':
self.mime = mime
self._size += len(data)
self._md5.update(data)
self._sha1.update(data)
self._write_chunk(data)
评论列表
文章目录