Read files in chunks to avoid OOM scenarios for large files.