nit: `if (file) {` will look as good