code: function writableBy(file, user) {
    function _writableBy(f, userData) {
      if (!exists(f)) {
        return _writableBy(path.dirname(f), userData);
      } else {
        return _accesibleByUser(userData, f, fs.W_OK);
      }
    }
    const uData = findUser(user);
    // root can always write
    if (uData.id === 0) {
      return true;
    } else if (uData.id === process.getuid()) {
      return writable(file);
    } else {
      return _writableBy(file, uData);
    }
  }
docs: Check whether a file is writable or not by a given user
  @function $file~writableBy
  @param {string} file
  @param {string|number} user - Username or user id to check permissions for
  @returns {boolean}
  @example
  // Check if 'conf/my.cnf' is writable by the 'nobody' user
  $file.writableBy('conf/my.cnf', 'nobody');
  // => false