diff --git a/lib/resin/data/fs-utils/fs-utils.coffee b/lib/resin/data/fs-utils/fs-utils.coffee index efd68c93..b9cf2958 100644 --- a/lib/resin/data/fs-utils/fs-utils.coffee +++ b/lib/resin/data/fs-utils/fs-utils.coffee @@ -1,10 +1,33 @@ fs = require('fs') _ = require('lodash') -# TODO: There should be more complex checks here +# Check if valid path +# +# @private +# +# @param {String} path path +# @return {Boolean} is valid path +# +# @todo There should be more complex checks here +# +# @example Is valid path? +# console.log isValidPath('/Users/me') # True +# console.log isValidPath([ 1, 2, 3 ]) # False +# exports.isValidPath = (p) -> return _.isString(p) +# Check if path is directory +# +# @private +# +# @param {String} directory directory +# @param {Function} callback callback(error, isDirectory) +# +# @example Is directory? +# console.log isDirectory('/usr/local/share') # True +# console.log isDirectory('/Users/me/app.js') # False +# exports.isDirectory = (directory, callback) -> fs.stat directory, (error, stats) -> return callback?(error) if error?