Lazy loading of PDF documents

This commit is contained in:
chrox 2024-10-16 13:01:02 +02:00
parent 1e66ab816b
commit ad8d249a3a
No known key found for this signature in database
GPG key ID: 07EA917B97209AE3
2 changed files with 2 additions and 8 deletions

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) };
}

@ -1 +1 @@
Subproject commit 337988cffcee09377fcc0216bddad3baf4ec2514
Subproject commit 4f300c6f3fe0ec91ab35015873ba270762567477