def get_image_files_json(image_id):
 files_json = get_image_files_cache(image_id)
 if files_json:
  return files_json
 image_path = store.image_layer_path(image_id)
 with tempfile.TemporaryFile() as tmp_fobj:
  for buf in store.stream_read(image_path):
   tmp_fobj.write(buf)
  tmp_fobj.seek(0)
  files_json = json.dumps(get_image_files_from_fobj(tmp_fobj))
 set_image_files_cache(image_id, files_json)
 return files_json

def get_image_files_json ( image_id ) : files_json = get_image_files_cache ( image_id ) if files_json : return files_json image_path = store . image_layer_path ( image_id ) with tempfile . TemporaryFile ( ) as tmp_fobj : for buf in store . stream_read ( image_path ) : tmp_fobj . write ( buf ) tmp_fobj . seek ( 0 ) files_json = json . dumps ( get_image_files_from_fobj ( tmp_fobj ) ) set_image_files_cache ( image_id , files_json ) return files_json
return json file listing for given image id download the specified layer and determine the file contents .