Answer the question
In order to leave comments, you need to log in
How do I pre-estimate the size of a file?
How can you pre-estimate the size of a generated file using dumpFile of the Symfony\Component\Filesystem class ?
In the class itself, I did not notice such an option.
Or do you still have to create a temporary file and see how long it took?
The code:
use Symfony\Component\Filesystem\Filesystem;
$filesystem = new Filesystem();
$filesystem->touch($_SERVER['DOCUMENT_ROOT'] . $url);
$filesystem->dumpFile($_SERVER['DOCUMENT_ROOT'] . $url, $data); // 5797960 bytes
strlen($data); // 5236968 bytes
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question