updated to node 22.2.0 to work with pdf.js 4.2.67
This commit is contained in:
@@ -11,12 +11,11 @@
|
||||
"dependencies": {
|
||||
"@stirling-tools/joi": "github:Stirling-Tools/joi",
|
||||
"buffer": "^6.0.3",
|
||||
"canvas": "^2.11.2",
|
||||
"i18next-resources-to-backend": "^1.2.0",
|
||||
"image-js": "^0.35.5",
|
||||
"memfs": "^4.9.2",
|
||||
"next-i18next": "^15.1.1",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdfjs-dist": "^4.0.269"
|
||||
"pdfjs-dist": "^4.2.67"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ import { PDFPageProxy } from "pdfjs-dist/types/src/display/api";
|
||||
|
||||
import * as PDFJS from "pdfjs-dist";
|
||||
|
||||
import { createCanvas } from "canvas";
|
||||
|
||||
export interface PDFJSImage {
|
||||
width: number;
|
||||
height: number;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as PDFJS from "pdfjs-dist";
|
||||
|
||||
import type { PDFDocumentProxy as PDFJSDocument } from "pdfjs-dist/types/src/display/api";
|
||||
import { PDFDocument as PDFLibDocument } from "pdf-lib";
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@ export const JoiPDFFileSchema = Joi.custom((value: Express.Multer.File[] /* <- a
|
||||
if(isPdfFileArray(value))
|
||||
return value;
|
||||
else { // File(s)
|
||||
if(value.some(f => f.mimetype != "application/pdf"))
|
||||
throw new Error("at least one of the files provided doesn't seem to be a PDF.");
|
||||
const firstWrongFile = value.find(f => f.mimetype != "application/pdf")
|
||||
if(firstWrongFile)
|
||||
throw new Error(`at least one of the files provided doesn't seem to be a PDF. Got ${firstWrongFile.mimetype} instead.`);
|
||||
|
||||
return PdfFile.fromMulterFiles(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user