use tempfile for streaming