Make sure file is not a directory before running readFileSync

Fixes failures due to snippets directory. (Not including snippets)