I couldn't figure out why my contact import stopped working, until I looked at
the tmp files that were all binary garble.
This:
$view = OC_App::getStorage('contacts');
$view->file_put_contents('/somefile.txt','some text');
produces:
+�Α½-ΰΑ%ίο8Sν
--
Med venlig hilsen / Best Regards
Thomas Tanghus