Temporary¶
use Innmind\IO\IO;
use Innmind\Immutable\{
Sequence,
Str,
};
$temporary = IO::fromAmbientAuthority()
->files()
->temporary(Sequence::of(
Str::of('chunk 1'),
Str::of("new line \n"),
Str::of('chunk 2'),
Str::of('etc...'),
))
->unwrap();
This creates a temporary file without having to think about where to store it.
You can then use it in 2 ways: