MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / readFileHeadBytes

Function readFileHeadBytes

packages/parser/src/utils.ts:18–24  ·  view source on GitHub ↗
(filePath: string, size: number)

Source from the content-addressed store, hash-verified

16 * 读取文件头部指定字节数
17 */
18export function readFileHeadBytes(filePath: string, size: number): string {
19 const fd = fs.openSync(filePath, 'r')
20 const buffer = Buffer.alloc(size)
21 const bytesRead = fs.readSync(fd, buffer, 0, size, 0)
22 fs.closeSync(fd)
23 return buffer.slice(0, bytesRead).toString('utf-8')
24}
25
26/**
27 * 创建进度对象

Callers 4

parseWeFlowFunction · 0.90
parseV4Function · 0.90
parseChatLabFunction · 0.90
parseDiscordExporterFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected