accepts file instead of path