MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / readFileSampleSync

Function readFileSampleSync

projects/electron/src/modules/code/files.ts:130–140  ·  view source on GitHub ↗
(filePath: string, size: number)

Source from the content-addressed store, hash-verified

128}
129
130function readFileSampleSync(filePath: string, size: number): Uint8Array {
131 if (size <= 0) return new Uint8Array()
132 const fd = fs.openSync(filePath, "r")
133 try {
134 const buffer = Buffer.alloc(Math.min(size, FILE_SIGNATURE_SAMPLE_BYTES))
135 const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, 0)
136 return buffer.subarray(0, bytesRead)
137 } finally {
138 fs.closeSync(fd)
139 }
140}
141
142/**
143 * Check if directory is within a git repository

Callers 1

handleDescribePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected