Move the getPage call in PDFDocumentProperties class
This allows us to remove an ESLint disable-statement for `arrow-body-style`, without affecting readability of the code, and fetching the metadata and the page in parallel should be a *tiny* bit more efficient as well.
This commit is contained in:
parent
8f08ca2150
commit
e5f744da04
@ -112,12 +112,13 @@ class PDFDocumentProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the document properties.
|
// Get the document properties.
|
||||||
const {
|
const [
|
||||||
info,
|
{ info, /* metadata, contentDispositionFilename, */ contentLength },
|
||||||
/* metadata, */
|
pdfPage,
|
||||||
/* contentDispositionFilename, */
|
] = await Promise.all([
|
||||||
contentLength,
|
this.pdfDocument.getMetadata(),
|
||||||
} = await this.pdfDocument.getMetadata();
|
this.pdfDocument.getPage(currentPageNumber),
|
||||||
|
]);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
fileName,
|
fileName,
|
||||||
@ -131,10 +132,7 @@ class PDFDocumentProperties {
|
|||||||
this.#parseFileSize(contentLength),
|
this.#parseFileSize(contentLength),
|
||||||
this.#parseDate(info.CreationDate),
|
this.#parseDate(info.CreationDate),
|
||||||
this.#parseDate(info.ModDate),
|
this.#parseDate(info.ModDate),
|
||||||
// eslint-disable-next-line arrow-body-style
|
this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation),
|
||||||
this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
|
|
||||||
return this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation);
|
|
||||||
}),
|
|
||||||
this.#parseLinearization(info.IsLinearized),
|
this.#parseLinearization(info.IsLinearized),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user