(path: string)
| 563 | // ── Directory operations (async) ─────────────────────────────────── |
| 564 | |
| 565 | async chdir(path: string): Promise<void> { |
| 566 | let target: string; |
| 567 | if (isAbsolute(path)) { |
| 568 | target = path; |
| 569 | } else { |
| 570 | target = resolve(this._cwd, path); |
| 571 | } |
| 572 | // Resolve to the real path via SFTP |
| 573 | const resolved = await sftpRealpath(this._sftp, target); |
| 574 | // Verify the resolved target is actually a directory. Without this |
| 575 | // guard, `realpath` happily returns file paths, causing later relative |
| 576 | // reads/writes/execs to treat a regular file as a working directory. |
| 577 | const attrs = await sftpStat(this._sftp, resolved); |
| 578 | if (!attrs.isDirectory()) { |
| 579 | throw new KaosValueError(`${resolved} is not a directory`); |
| 580 | } |
| 581 | this._cwd = resolved; |
| 582 | } |
| 583 | |
| 584 | async stat(path: string, options?: { followSymlinks?: boolean }): Promise<StatResult> { |
| 585 | const resolved = this._resolvePath(path); |
nothing calls this directly
no test coverage detected