(filePath: string)
| 20 | } |
| 21 | |
| 22 | async 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 |
nothing calls this directly
no test coverage detected