Closed
Description
The README refers to installing ^0.2
but I didn't see that in Packagist and got an error when trying to install it.
But it looks like this was just rewritten 4 days ago! what a coincidence as I'm trying to use it for the first time in a project.
That said, I have a question. Is this a valid alternative to using this project which is still experimental? Sample code follows below:
$path = '/foo/bar/file.css';
if (is_readable($path)) {
$mimeType = $this->getMimeType($path);
$fileStream = new ReadableResourceStream(fopen($path, 'rb'));
$bodyStream = new ReadableBodyStream($fileStream, filesize($path));
$headers = [
'Content-Type' => $mimeType,
];
return new \React\Http\Message\Response(200, $headers, $bodyStream);
}
I know already this example violates some of the async principles, for example these are all blocking: is_readable
, fopen
, filesize
but this is only for a dev-convenience function not for production use. I have confirmed this works thus far, but wanted to see if this reactphp/filesystem
project could be used as a more proper implementation. Thanks!
Metadata
Metadata
Assignees
Labels
No labels