export to temp file rather than to in memory buffer