Be more explicit about detecting fs.readdirSync support.

Tools like Browserify result in a `require('fs')` that returns something not falsey, so this more explicit checking prevents the `fs.readdirSync` call from being attempted unless the function itself exists.