Closed
Description
Description
I only require built-in local server php -S localhost:8000
and passthru()
, not the remainder of PHP.
Additionally I need to make requests to the local server using a symbolic link.
Are the above two requirements possible?
<?php
header('Vary: Origin');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
header("Content-Type: application/octet-stream");
header("X-Powered-By:");
echo passthru("parec -d @DEFAULT_MONITOR@");
exit();
}
let abortable = new AbortController();
let {signal} = abortable;
// 'chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/test.txt'
// is symbolic link to http://localhost:8000
fetch('chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/test.txt', {signal})
.then((r) => r.body)
.then((readable) => readable.pipeTo(new WritableStream({
write(v) {console.log(v) // do stuff},
close() {console.log('Stream closed.')}
}))
.catch(console.warn);