data_juicer.ops.mapper.download_file_mapper module¶
- class data_juicer.ops.mapper.download_file_mapper.DownloadFileMapper(download_field: str = None, save_dir: str = None, save_field: str = None, resume_download: bool = False, timeout: int = 30, max_concurrent: int = 10, *args, **kwargs)[source]¶
Bases:
Mapper
Mapper to download url files to local files or load them into memory.
- __init__(download_field: str = None, save_dir: str = None, save_field: str = None, resume_download: bool = False, timeout: int = 30, max_concurrent: int = 10, *args, **kwargs)[source]¶
Initialization method.
- Parameters:
save_dir – The directory to save downloaded files.
download_field – The filed name to get the url to download.
save_field – The filed name to save the downloaded file content.
resume_download – Whether to resume download. if True, skip the sample if it exists.
timeout – Timeout for download.
max_concurrent – Maximum concurrent downloads.
args – extra args
kwargs – extra args