WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#16236 closed task (blessed)

Method to stream file downloads in HTTP API, to reduce update memory footprint — at Version 1

Reported by: markjaquith Owned by:
Milestone: 3.2 Priority: normal
Severity: normal Version:
Component: HTTP API Keywords: needs-testing
Focuses: Cc:

Description (last modified by dd32)

Method to stream file downloads in HTTP API, to reduce update memory footprint

Change History (2)

comment:1 @dd325 years ago

  • Component changed from General to HTTP
  • Description modified (diff)
  • Keywords 3.2-early added

fsockopen, fopen: fread()+fwrite() loop, easy

streams: stream_copy_to_stream($http_handle, $new_file_handle);

HTTP Extension: I cant see a case there which allows for streaming directly to files, So will probably have to read into memory, and write it out.

cURL: Can use CURLOPT_FILE to specify where to write the output, CURLOPT_WRITEHEADER or CURLOPT_HEADERFUNCTION should be able to be used to capture the header data

Some of the classes might be able to be unset or destroyed better to decrease memory usage after a request is made.

@sivel4 years ago

Some early code to support stream to file using cURL

Note: See TracTickets for help on using tickets.