Lazy loading of PDF documents

This commit is contained in:
chrox
2024-10-16 13:01:02 +02:00
parent 1e66ab816b
commit ad8d249a3a
2 changed files with 2 additions and 8 deletions
+1 -7
View File
@@ -147,13 +147,7 @@ export abstract class BaseAppService implements AppService {
async loadBookContent(book: Book): Promise<BookContent> {
const fp = getFilename(book);
let file: File;
if (fp.endsWith('.pdf')) {
const content = await this.fs.readFile(fp, 'Books', 'binary');
file = new File([content], fp, { type: 'application/pdf' });
} else {
file = await new RemoteFile(this.fs.getURL(`${this.localBooksDir}/${fp}`), fp).open();
}
let file = await new RemoteFile(this.fs.getURL(`${this.localBooksDir}/${fp}`), fp).open();
return { book, file, config: await this.loadBookConfig(book) };
}