code: def transform(src, dst, converter,
                overwrite=False, stream=True, chunksize=1024**2, **kwargs):
      
      if not overwrite:  # pragma: no cover
          if Path(dst).exists():
              raise EnvironmentError("'%s' already exists!" % dst)
  
      with open(src, "rb") as f_input:
          with open(dst, "wb") as f_output:
              if stream:
                  # fix chunksize to a reasonable range
                  if chunksize > 1024 ** 2 * 10:
                      chunksize = 1024 ** 2 * 10
                  elif chunksize < 1024 ** 2:
                      chunksize = 1024 ** 2
  
                  # write file
                  while 1:
                      content = f_input.read(chunksize)
                      if content:
                          f_output.write(converter(content, **kwargs))
                      else:
                          break
              else:  # pragma: no cover
                  f_output.write(converter(f_input.read(), **kwargs))
docs: A file stream transform IO utility function.
  
      :param src: original file path
      :param dst: destination file path
      :param converter: binary content converter function
      :param overwrite: default False,
      :param stream: default True, if True, use stream IO mode, chunksize has to
        be specified.
      :param chunksize: default 1MB