list(remotePath, filter, addListeners = true) {
    let listeners;
    return new Promise((resolve, reject) => {
      if (addListeners) {
        listeners = addTempListeners(this, 'list', reject);
      }
      if (haveConnection(this, 'list', reject)) {
        this.sftp.readdir(remotePath, (err, fileList) => {
          if (err) {
            reject(this.fmtError(`${err.message} ${remotePath}`, 'list', err.code));
          } else {
            const reg = /-/gi;
            const newList = fileList.map((item) => {
              return {
                type: item.longname.slice(0, 1),
                name: item.filename,
                size: item.attrs.size,
                modifyTime: item.attrs.mtime * 1000,
                accessTime: item.attrs.atime * 1000,
                rights: {
                  user: item.longname.slice(1, 4).replaceAll(reg, ''),
                  group: item.longname.slice(4, 7).replaceAll(reg, ''),
                  other: item.longname.slice(7, 10).replaceAll(reg, ''),
                },
                owner: item.attrs.uid,
                group: item.attrs.gid,
                longname: item.longname,
              };
            });
            if (filter) {
              resolve(newList.filter((item) => filter(item)));
            } else {
              resolve(newList);
            }
          }
        });
      }
    }).finally(() => {
      if (addListeners) {
        removeTempListeners(this, listeners, 'list');
      }
    });
  }
@async

List contents of a remote directory. If a pattern is provided,
filter the results to only include files with names that match
the supplied pattern. Return value is an array of file entry
objects that include properties for type, name, size, modifyTime,
accessTime, rights {user, group other}, owner and group.

@param {String} remotePath - path to remote directory
@param {function} filter - a filter function used to select return entries
@param {Boolean} addListeners - (Optional) if true, add listeners. Default true
@returns {Promise<Array>} array of file description objects