Remove isbinaryfile as this caused errors on some users computers

This commit is contained in:
Saoud Rizwan
2024-09-06 12:26:13 -04:00
parent 9eaf753000
commit 0a16aedf95
3 changed files with 4 additions and 24 deletions

View File

@@ -2,7 +2,6 @@ import * as path from "path"
// @ts-ignore-next-line
import pdf from "pdf-parse/lib/pdf-parse"
import mammoth from "mammoth"
import { isBinaryFile } from "isbinaryfile"
import fs from "fs/promises"
export async function extractTextFromFile(filePath: string): Promise<string> {
@@ -20,12 +19,7 @@ export async function extractTextFromFile(filePath: string): Promise<string> {
case ".ipynb":
return extractTextFromIPYNB(filePath)
default:
const isBinary = await isBinaryFile(filePath)
if (!isBinary) {
return await fs.readFile(filePath, "utf8")
} else {
throw new Error(`Unsupported file type: ${fileExtension}`)
}
return await fs.readFile(filePath, "utf8")
}
}