Replace temporary files with in-memory string reader

Windows `tmpfile()` cannot handle large amounts of created temporary
files, so we use in-memory string reader from Penlight as a temporary
storage. This should definitely fix long-running operations on Windows.