photon / worker-download
A worker to send large content without filling the RAM.
Installs: 1 123
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- photon/photon: >=0.5.0
- phuedx/tnetstring: ~2.0.0
README
A worker to stream just-in-time a HTTP Response from a iterator
Quick start
-
Add the module in your project
composer require "photon/worker-download"
-
Add the worker in the configuration
'installed_tasks' => array( 'PhotonDownload' => '\photon\task\PhotonDownload', ), 'photon_task_PhotonDownload' => array( 'sub_addr' => 'tcp://127.0.0.1:11011', ),
-
Start the worker
hnu worker PhotonDownload
-
Send work to the worker in a view
public function m2stream($request, $match) { $ans = new \photon\http\Response(new MyStream); $ans->headers['Content-Length'] = 247463936;
\photon\task\PhotonDownload::createDownload($request, $ans); return false;
}