Maybe the default filename extension should depend on the value of `format`.