MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getTaskOutput

Function getTaskOutput

src/utils/task/diskOutput.ts:336–357  ·  view source on GitHub ↗
(
  taskId: string,
  maxBytes: number = DEFAULT_MAX_READ_BYTES,
)

Source from the content-addressed store, hash-verified

334 * Caps at maxBytes to avoid loading multi-GB files into memory.
335 */
336export async function getTaskOutput(
337 taskId: string,
338 maxBytes: number = DEFAULT_MAX_READ_BYTES,
339): Promise<string> {
340 try {
341 const { content, bytesTotal, bytesRead } = await tailFile(
342 getTaskOutputPath(taskId),
343 maxBytes,
344 )
345 if (bytesTotal > bytesRead) {
346 return `[${Math.round((bytesTotal - bytesRead) / 1024)}KB of earlier output omitted]\n${content}`
347 }
348 return content
349 } catch (e) {
350 const code = getErrnoCode(e)
351 if (code === 'ENOENT') {
352 return ''
353 }
354 logError(e)
355 return ''
356 }
357}
358
359/**
360 * Get the current size (offset) of a task's output file.

Callers 1

getTaskOutputDataFunction · 0.50

Calls 4

tailFileFunction · 0.85
getTaskOutputPathFunction · 0.85
getErrnoCodeFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected