@mdgf11/filesystem-lib 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdgf11/filesystem-lib",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Library to extend usage of jurisprudencia-document",
5
5
  "license": "ISC",
6
6
  "author": "Miguel Fonseca",
@@ -3,6 +3,7 @@ import fs from "fs";
3
3
  import mammoth from "mammoth";
4
4
  import { ContentType, Date_Area_Section, DETAILS_NAME, FILESYSTEM_PATH, FilesystemDocument, ORIGINAL_NAME, Retrievable_Metadata, ROOT_PATH, SHAREPOINT_COPY_PATH, Sharepoint_Metadata, SupportedUpdateSources } from "./types.js";
5
5
  import { DescritorOficial } from "./descritores.js";
6
+ import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
6
7
 
7
8
  export function writeFilesystemDocument(filesystem_document: FilesystemDocument): void {
8
9
  if (!filesystem_document.content)
@@ -132,8 +133,7 @@ export async function createJurisprudenciaDocument(retrievable_Metadata: Retriev
132
133
  export async function hasSelectableText(buffer: Buffer): Promise<boolean> {
133
134
  try {
134
135
  const uint8Array = new Uint8Array(buffer);
135
- const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
136
- const loadingTask = pdfjsLib.getDocument({
136
+ const loadingTask = getDocument({
137
137
  data: uint8Array,
138
138
  standardFontDataUrl: 'node_modules/pdfjs-dist/standard_fonts/',
139
139
  });
@@ -178,8 +178,7 @@ async function extractContent(contents: ContentType[]): Promise<string[]> {
178
178
 
179
179
  async function pdfToLines(buffer: Buffer): Promise<string[]> {
180
180
  const uint8Array = new Uint8Array(buffer);
181
- const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
182
- const loadingTask = pdfjsLib.getDocument({ data: uint8Array, verbosity: 0 });
181
+ const loadingTask = getDocument({ data: uint8Array, verbosity: 0 });
183
182
  const pdf = await loadingTask.promise;
184
183
 
185
184
  const allLines: string[] = [];