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

Method writeText

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

Source from the content-addressed store, hash-verified

654 }
655
656 async writeText(
657 path: string,
658 data: string,
659 options?: { mode?: 'w' | 'a'; encoding?: BufferEncoding },
660 ): Promise<number> {
661 const resolved = this._resolvePath(path);
662 const encoding = options?.encoding ?? 'utf-8';
663 const mode = options?.mode ?? 'w';
664 if (mode === 'a') {
665 await appendFile(resolved, data, encoding);
666 } else {
667 await writeFile(resolved, data, encoding);
668 }
669 return data.length;
670 }
671
672 async mkdir(path: string, options?: { parents?: boolean; existOk?: boolean }): Promise<void> {
673 const resolved = this._resolvePath(path);

Callers

nothing calls this directly

Calls 3

_resolvePathMethod · 0.95
appendFileFunction · 0.50
writeFileFunction · 0.50

Tested by

no test coverage detected