def DownloadFile(file_obj, target_path, buffer_size=BUFFER_SIZE):
 logging.info(u'Downloading: %s to: %s', file_obj.urn, target_path)
 target_file = open(target_path, 'wb')
 file_obj.Seek(0)
 count = 0
 data_buffer = file_obj.Read(buffer_size)
 while data_buffer:
  target_file.write(data_buffer)
  data_buffer = file_obj.Read(buffer_size)
  count += 1
  if (not (count % 3)):
   logging.debug(u'Downloading: %s: %s done', file_obj.urn, utils.FormatNumberAsString((count * buffer_size)))
 target_file.close()

def DownloadFile ( file_obj , target_path , buffer_size = BUFFER_SIZE ) : logging . info ( u'Downloading: %s to: %s' , file_obj . urn , target_path ) target_file = open ( target_path , 'wb' ) file_obj . Seek ( 0 ) count = 0 data_buffer = file_obj . Read ( buffer_size ) while data_buffer : target_file . write ( data_buffer ) data_buffer = file_obj . Read ( buffer_size ) count += 1 if ( not ( count % 3 ) ) : logging . debug ( u'Downloading: %s: %s done' , file_obj . urn , utils . FormatNumberAsString ( ( count * buffer_size ) ) ) target_file . close ( )
download an aff4 file to the local filesystem overwriting it if it exists .