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

Method writeText

packages/kaos/src/ssh.ts:752–767  ·  view source on GitHub ↗
(
    path: string,
    data: string,
    options?: { mode?: 'w' | 'a'; encoding?: BufferEncoding },
  )

Source from the content-addressed store, hash-verified

750 }
751
752 async writeText(
753 path: string,
754 data: string,
755 options?: { mode?: 'w' | 'a'; encoding?: BufferEncoding },
756 ): Promise<number> {
757 const resolved = this._resolvePath(path);
758 const mode = options?.mode ?? 'w';
759 const encoding = options?.encoding ?? 'utf-8';
760 const buf = Buffer.from(data, encoding);
761 if (mode === 'a') {
762 await sftpAppendFile(this._sftp, resolved, buf);
763 } else {
764 await sftpWriteFile(this._sftp, resolved, buf);
765 }
766 return data.length;
767 }
768
769 async mkdir(path: string, options?: { parents?: boolean; existOk?: boolean }): Promise<void> {
770 const resolved = this._resolvePath(path);

Callers

nothing calls this directly

Calls 3

_resolvePathMethod · 0.95
sftpAppendFileFunction · 0.85
sftpWriteFileFunction · 0.85

Tested by

no test coverage detected