MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / stat

Method stat

packages/kaos/src/ssh.ts:584–608  ·  view source on GitHub ↗
(path: string, options?: { followSymlinks?: boolean })

Source from the content-addressed store, hash-verified

582 }
583
584 async stat(path: string, options?: { followSymlinks?: boolean }): Promise<StatResult> {
585 const resolved = this._resolvePath(path);
586 const followSymlinks = options?.followSymlinks ?? true;
587 // sftpStat / sftpLstat already wrap errors via mapSftpError.
588 const st = followSymlinks
589 ? await sftpStat(this._sftp, resolved)
590 : await sftpLstat(this._sftp, resolved);
591
592 return {
593 stMode: buildStMode(st),
594 // SFTP does not provide inode
595 stIno: 0,
596 // SFTP does not provide device
597 stDev: 0,
598 // ssh2 Stats does not expose nlink
599 stNlink: 0,
600 stUid: st.uid,
601 stGid: st.gid,
602 stSize: st.size,
603 stAtime: st.atime,
604 stMtime: st.mtime,
605 // SFTP v3 has no ctime, fallback to mtime
606 stCtime: st.mtime,
607 };
608 }
609
610 async *iterdir(path: string): AsyncGenerator<string> {
611 const resolved = this._resolvePath(path);

Callers

nothing calls this directly

Calls 4

_resolvePathMethod · 0.95
sftpStatFunction · 0.85
sftpLstatFunction · 0.85
buildStModeFunction · 0.85

Tested by

no test coverage detected