buffer to file & file to buffer