MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / extractTextFromIPYNB

Function extractTextFromIPYNB

src/integrations/misc/extract-text.ts:22–34  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

20}
21
22async function extractTextFromIPYNB(filePath: string): Promise<string> {
23 const data = await fs.readFile(filePath, "utf8")
24 const notebook = JSON.parse(data)
25 let extractedText = ""
26
27 for (const cell of notebook.cells) {
28 if ((cell.cell_type === "markdown" || cell.cell_type === "code") && cell.source) {
29 extractedText += cell.source.join("\n") + "\n"
30 }
31 }
32
33 return addLineNumbers(extractedText)
34}
35
36/**
37 * Map of supported binary file formats to their extraction functions

Callers

nothing calls this directly

Calls 3

addLineNumbersFunction · 0.85
parseMethod · 0.80
readFileMethod · 0.45

Tested by

no test coverage detected