@mdgf11/filesystem-lib 2.0.2 → 2.0.3

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.2",
3
+ "version": "2.0.3",
4
4
  "description": "Library to extend usage of jurisprudencia-document",
5
5
  "license": "ISC",
6
6
  "author": "Miguel Fonseca",
@@ -1,7 +1,6 @@
1
1
  import { calculateHASH, calculateUUID, JurisprudenciaDocument, PartialJurisprudenciaDocument } from "@stjiris/jurisprudencia-document";
2
2
  import fs from "fs";
3
3
  import mammoth from "mammoth";
4
- import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs';
5
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";
6
5
  import { DescritorOficial } from "./descritores.js";
7
6
 
@@ -133,6 +132,7 @@ export async function createJurisprudenciaDocument(retrievable_Metadata: Retriev
133
132
  export async function hasSelectableText(buffer: Buffer): Promise<boolean> {
134
133
  try {
135
134
  const uint8Array = new Uint8Array(buffer);
135
+ const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
136
136
  const loadingTask = pdfjsLib.getDocument({
137
137
  data: uint8Array,
138
138
  standardFontDataUrl: 'node_modules/pdfjs-dist/standard_fonts/',
@@ -178,6 +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');
181
182
  const loadingTask = pdfjsLib.getDocument({ data: uint8Array, verbosity: 0 });
182
183
  const pdf = await loadingTask.promise;
183
184