Support for writing to a file, and sync option