@mdgf11/filesystem-lib 2.0.2 → 2.0.4
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { calculateHASH, calculateUUID } 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 { DETAILS_NAME, FILESYSTEM_PATH, ORIGINAL_NAME, ROOT_PATH, SHAREPOINT_COPY_PATH } from "./types.js";
|
|
6
5
|
import { DescritorOficial } from "./descritores.js";
|
|
7
6
|
export function writeFilesystemDocument(filesystem_document) {
|
|
@@ -120,6 +119,7 @@ export async function createJurisprudenciaDocument(retrievable_Metadata, content
|
|
|
120
119
|
export async function hasSelectableText(buffer) {
|
|
121
120
|
try {
|
|
122
121
|
const uint8Array = new Uint8Array(buffer);
|
|
122
|
+
const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
|
|
123
123
|
const loadingTask = pdfjsLib.getDocument({
|
|
124
124
|
data: uint8Array,
|
|
125
125
|
standardFontDataUrl: 'node_modules/pdfjs-dist/standard_fonts/',
|
|
@@ -159,6 +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');
|
|
162
163
|
const loadingTask = pdfjsLib.getDocument({ data: uint8Array, verbosity: 0 });
|
|
163
164
|
const pdf = await loadingTask.promise;
|
|
164
165
|
const allLines = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdgf11/filesystem-lib",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Library to extend usage of jurisprudencia-document",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Miguel Fonseca",
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@stjiris/jurisprudencia-document": "npm:@mdgf11/jurisprudencia-document@^13.1.0",
|
|
17
|
+
"canvas": "^3.2.1",
|
|
17
18
|
"dotenv": "^17.2.2",
|
|
19
|
+
"jsdom": "^27.4.0",
|
|
18
20
|
"mammoth": "^1.10.0",
|
|
19
21
|
"pdfjs-dist": "^5.4.530"
|
|
20
22
|
},
|
|
@@ -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
|
|