public readdir()

in packages/web-ide-fs/src/browserfs/GitLabReadableFileSystem.ts [183:201]


  public readdir(path: string, cb: BFSCallback<string[]>): void {
    // Check if it exists.
    const fileEntry = this.#entries.get(path);

    if (!fileEntry) {
      cb(ApiError.ENOENT(path));
    } else if (fileEntry.type === FileType.Tree) {
      const childNames = fileEntry.children.map(x => {
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
        const [parent, name] = splitParent(x);

        return name;
      });

      cb(null, childNames);
    } else {
      cb(ApiError.ENOTDIR(path));
    }
  }