Make sure file is not a directory before running readFileSync