I have code that takes binary files and converts them to base64, but there are very large files and this ends up using a lot of the machine's memory (and even the process). To read large files usually (without converting them) I do this:
$handle = fopen('ARQUIVO', 'r');
while (FALSE === feof($handle)) {
$data = fgets($handle);
...
}
fclose($handle);
So I avoid exceeding memory and other problems of the genre. But the problem is that with base64_encode
I need the complete data (the% with% integer ).
How to encode large binary files without losing performance?