Allow reading file data from memory

Changes the file rendering to allow both saving to file and writing to memory.