class_docstr: Download op
class_docstr_tok: ["Download","op"]
docstr: Download file at the given URL to a local path.
  Args:
      url (str): URL of the file to download
      dst (str): Full path where file will be saved
docstr_tok: ["Download","file","at","the","given","URL","to","a","local","path",".","Args",":","url","(","str",")",":","URL","of","the","file","to","download","dst","(","str",")",":","Full","path","where","file","will","be","saved"]
code: def download_url_to_file(
      url: str, dst: str, file_size: int = None
  ) -> bool:
      """Download file at the given URL to a local path.
      Args:
          url (str): URL of the file to download
          dst (str): Full path where file will be saved
      """
  
      with requests.get(url, stream=True) as r:
          r.raise_for_status()
          try:
              if file_size is None:
                  file_size = int(r.headers.get("content-length", 0))
              dst_dir = os.path.dirname(dst)
              with tempfile.NamedTemporaryFile(
                  delete=False, dir=dst_dir
              ) as f:
                  with tqdm(
                      total=file_size,
                      unit="B",
                      unit_scale=True,
                      desc=f"Downloading {url} to {dst_dir}",
                  ) as pbar:
                      for chunk in r.iter_content(chunk_size=8192):
                          real_size = f.write(chunk)
                          pbar.update(real_size)
              shutil.move(f.name, dst)
          finally:
              if os.path.exists(f.name):
                  os.remove(f.name)
  
imports: import os
  import sys
  import tempfile
  import shutil
  from pathlib import Path
  from concurrent.futures import ThreadPoolExecutor
  import subprocess
  import requests
  from tqdm import tqdm
  from tenacity import retry, stop_after_attempt, wait_random_exponential
  from towhee.utils.hub_utils import HubUtils
label_desc: Use image node_id 2 for calling the _Downloader obj's underlying member method code with example usage: obj.download_url_to_file(url, dst, file_size) without return types