encryptStream documentation could use a little more code
lekoala opened this issue · 2 comments
lekoala commented
so i was using this bit of code
$input = \fopen('/tmp/super-secret', 'rb');
$output = \fopen('php://temp', 'wb');
$encFile->encryptStream($input, $output);
then, I expected this to work
file_put_contents($filename, $output);
but I ended up with an empty file! Surely something must be wrong? And yes, because the pointer is at the end of the file !
so either, I need to do this
rewind($output);
file_put_contents($path, $output);
or encryptStream should return a rewinded stream
anyway, it's probably worth mentionning just for other people like me that might otherwise end up scratching their head for no reasons :-)
lekoala commented
and the same apply for decryptStream
lekoala commented
Nice!