Refactored to match the node-filesystem.js example.