MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / fileLooksLikeTranscript

Function fileLooksLikeTranscript

lib/transcript.js:34–52  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

32}
33
34function fileLooksLikeTranscript(filePath) {
35 try {
36 const stat = fs.statSync(filePath);
37 if (stat.size <= 0) return false;
38 const readSize = Math.min(stat.size, 64 * 1024);
39 const fd = fs.openSync(filePath, 'r');
40 const buf = Buffer.alloc(readSize);
41 fs.readSync(fd, buf, 0, readSize, stat.size - readSize);
42 fs.closeSync(fd);
43 const lines = buf.toString('utf8').split('\n').filter(Boolean);
44 for (const line of lines) {
45 try {
46 const evt = JSON.parse(line);
47 if (hasConversationEvent(evt)) return true;
48 } catch {}
49 }
50 } catch {}
51 return false;
52}
53
54function flattenUserContent(content) {
55 if (typeof content === 'string') return content;

Callers 3

maybeAttachHookSessionFunction · 0.85
startSwitchWatcherFunction · 0.85

Calls 1

hasConversationEventFunction · 0.85

Tested by

no test coverage detected