make compatible with Broswerify

Browserify implements a subset of the fs module, so the current check passes, but it does not support readdirSync, so that call fails.