MCPcopy
hub / github.com/simstudioai/sim / parseBuffer

Method parseBuffer

apps/sim/lib/file-parsers/md-parser.ts:24–42  ·  view source on GitHub ↗
(buffer: Buffer)

Source from the content-addressed store, hash-verified

22 }
23
24 async parseBuffer(buffer: Buffer): Promise<FileParseResult> {
25 try {
26 logger.info('Parsing buffer, size:', buffer.length)
27
28 const result = buffer.toString('utf-8')
29 const content = sanitizeTextForUTF8(result)
30
31 return {
32 content,
33 metadata: {
34 characterCount: content.length,
35 tokenCount: Math.floor(content.length / 4),
36 },
37 }
38 } catch (error) {
39 logger.error('MD buffer parsing error:', error)
40 throw new Error(`Failed to parse MD buffer: ${(error as Error).message}`)
41 }
42 }
43}

Callers 1

parseFileMethod · 0.95

Calls 4

sanitizeTextForUTF8Function · 0.90
infoMethod · 0.80
errorMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected