Automattic\WooCommerce\Admin

ReportCSVExporter::stream_export_file │ public │ WC 11.2.0

Write the export to the output, leaving the file in place. Send the download headers first.

Method of the class: ReportCSVExporter{}

No Hooks.

Returns

void. Nothing (null).

Usage

$ReportCSVExporter = new ReportCSVExporter();
$ReportCSVExporter->stream_export_file();

Changelog

Since 11.2.0 Introduced.

ReportCSVExporter::stream_export_file() code WC 11.2.1

public function stream_export_file() {
	$this->send_content( $this->get_headers_row_file() );

	// Stream the body instead of reading it into memory. Exports are emailed precisely when the
	// report is too large to return in one request, so it can be far larger than the memory limit.
	readfile( $this->get_file_path() ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile, WordPress.Security.EscapeOutput.OutputNotEscaped -- Streaming a generated CSV download.
}