1
0
mirror of https://github.com/danog/file.git synced 2024-11-30 04:19:39 +01:00
file/examples/stream.php
2023-03-02 22:25:46 +01:00

15 lines
302 B
PHP

<?php
use Amp\File;
use function Amp\ByteStream\getStdin;
use function Amp\ByteStream\pipe;
require __DIR__ . '/../vendor/autoload.php';
$tempFile = tempnam(sys_get_temp_dir(), 'test-');
print "Writing stdin to $tempFile" . PHP_EOL;
$file = File\openFile($tempFile, 'w');
pipe(getStdin(), $file);