Make file method work with File object