1
0
mirror of https://github.com/danog/file.git synced 2024-12-02 09:17:57 +01:00
file/examples/stream.php

15 lines
302 B
PHP
Raw Permalink Normal View History

2023-03-02 22:25:19 +01:00
<?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);