MCPcopy
hub / github.com/deepnote/deepnote / convertFile

Function convertFile

packages/cli/src/commands/convert.ts:73–85  ·  view source on GitHub ↗
(inputPath: string, options: ConvertOptions)

Source from the content-addressed store, hash-verified

71}
72
73async function convertFile(inputPath: string, options: ConvertOptions): Promise<ConvertResult> {
74 const { absolutePath, isDirectory, extension: ext } = await resolvePath(inputPath)
75
76 // Determine input format
77 const inputFormat = await determineInputFormat(absolutePath, isDirectory, ext)
78
79 // Perform conversion
80 if (inputFormat === 'deepnote') {
81 const outputFormat = options.format ?? 'jupyter'
82 return convertFromDeepnote(absolutePath, outputFormat, options)
83 }
84 return convertToDeepnote(absolutePath, inputFormat, isDirectory, options)
85}
86
87async function determineInputFormat(absolutePath: string, isDirectory: boolean, ext: string): Promise<NotebookFormat> {
88 if (ext === '.deepnote') {

Callers 1

createConvertActionFunction · 0.85

Calls 4

resolvePathFunction · 0.90
determineInputFormatFunction · 0.85
convertFromDeepnoteFunction · 0.85
convertToDeepnoteFunction · 0.85

Tested by

no test coverage detected