Merge pull request #309 from C4illin/fix/301/add-support-for-kepub

This commit is contained in:
Emrik Östling 2025-06-04 10:28:13 +02:00 committed by GitHub
commit f1c5cd9f6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,6 +39,7 @@ export const properties = {
"fb2", "fb2",
"html", "html",
"htmlz", "htmlz",
"kepub.epub",
"lit", "lit",
"lrf", "lrf",
"mobi", "mobi",
@ -65,20 +66,24 @@ export async function convert(
options?: unknown, options?: unknown,
): Promise<string> { ): Promise<string> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
execFile("ebook-convert", [filePath, targetPath], (error, stdout, stderr) => { execFile(
if (error) { "ebook-convert",
reject(`error: ${error}`); [filePath, targetPath],
} (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
}
if (stdout) { if (stdout) {
console.log(`stdout: ${stdout}`); console.log(`stdout: ${stdout}`);
} }
if (stderr) { if (stderr) {
console.error(`stderr: ${stderr}`); console.error(`stderr: ${stderr}`);
} }
resolve("Done"); resolve("Done");
}); },
);
}); });
} }