Take format type as argument for file write.