code: function writable(file) {
    if (!exists(file)) {
      return writable(path.dirname(file));
    } else {
      try {
        fs.accessSync(file, fs.W_OK);
      } catch (e) {
        return false;
      }
      return true;
    }
  }
docs: Check whether a file is writable or not
  @function $file~writable
  @param {string} file
  @returns {boolean}
  @example
  // Check if 'conf/my.cnf' is writable by the current user
  $file.writable('conf/my.cnf');
  // => true