(filePath: string)
| 211 | * @returns The converted DeepnoteFile with metadata about the conversion |
| 212 | */ |
| 213 | export 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 | } |
no test coverage detected