MCPcopy
hub / github.com/deepnote/deepnote / loadRunnableFile

Function loadRunnableFile

packages/convert/src/load-runnable-file.ts:213–229  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

211 * @returns The converted DeepnoteFile with metadata about the conversion
212 */
213export async function loadRunnableFile(filePath: string): Promise<LoadedRunnableFile> {
214 const absolutePath = path.resolve(filePath)
215 const ext = path.extname(absolutePath).toLowerCase()
216
217 if (!isRunnableExtension(ext)) {
218 throw unsupportedExtensionError(ext)
219 }
220
221 if (ext === '.deepnote') {
222 const rawBytes = await fs.readFile(absolutePath)
223 const content = decodeUtf8NoBom(rawBytes)
224 return parseRunnableFileContent(content, absolutePath)
225 }
226
227 const content = await fs.readFile(absolutePath, 'utf-8')
228 return parseRunnableFileContent(content, absolutePath)
229}

Callers 4

resolveRunnableWithInitFunction · 0.90

Calls 4

decodeUtf8NoBomFunction · 0.90
isRunnableExtensionFunction · 0.85
parseRunnableFileContentFunction · 0.85

Tested by

no test coverage detected