@mdgf11/filesystem-lib 2.0.5 → 2.0.6

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.
@@ -3,6 +3,7 @@ import fs from "fs";
3
3
  import mammoth from "mammoth";
4
4
  import { DETAILS_NAME, FILESYSTEM_PATH, ORIGINAL_NAME, ROOT_PATH, SHAREPOINT_COPY_PATH } from "./types.js";
5
5
  import { DescritorOficial } from "./descritores.js";
6
+ import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
6
7
  export function writeFilesystemDocument(filesystem_document) {
7
8
  if (!filesystem_document.content)
8
9
  return;
@@ -119,8 +120,7 @@ export async function createJurisprudenciaDocument(retrievable_Metadata, content
119
120
  export async function hasSelectableText(buffer) {
120
121
  try {
121
122
  const uint8Array = new Uint8Array(buffer);
122
- const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
123
- const loadingTask = pdfjsLib.getDocument({
123
+ const loadingTask = getDocument({
124
124
  data: uint8Array,
125
125
  standardFontDataUrl: 'node_modules/pdfjs-dist/standard_fonts/',
126
126
  });
@@ -159,8 +159,7 @@ async function extractContent(contents) {
159
159
  }
160
160
  async function pdfToLines(buffer) {
161
161
  const uint8Array = new Uint8Array(buffer);
162
- const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
163
- const loadingTask = pdfjsLib.getDocument({ data: uint8Array, verbosity: 0 });
162
+ const loadingTask = getDocument({ data: uint8Array, verbosity: 0 });
164
163
  const pdf = await loadingTask.promise;
165
164
  const allLines = [];
166
165
  for (let i = 1; i <= pdf.numPages; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdgf11/filesystem-lib",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Library to extend usage of jurisprudencia-document",
5
5
  "license": "ISC",
6
6
  "author": "Miguel Fonseca",