@@ -4,7 +4,7 @@ const { execFile, spawn, spawnSync } = require("node:child_process");
44const { promisify } = require ( "node:util" ) ;
55const camelCase = require ( "camelcase" ) ;
66const { lt } = require ( "semver" ) ;
7- const { joinSafe , normalizeTrim } = require ( "upath " ) ;
7+ const { normalize , resolve : pathResolve } = require ( "node:path " ) ;
88
99const execFileAsync = promisify ( execFile ) ;
1010
@@ -110,7 +110,7 @@ class Poppler {
110110 this . popplerPath = popplerPath ;
111111 }
112112 if ( platform === "win32" && ! popplerPath ) {
113- this . popplerPath = joinSafe (
113+ this . popplerPath = pathResolve (
114114 __dirname ,
115115 "lib" ,
116116 "win32" ,
@@ -127,7 +127,7 @@ class Poppler {
127127 `Unable to find ${ process . platform } Poppler binaries, please pass the installation directory as a parameter to the Poppler instance.`
128128 ) ;
129129 }
130- this . popplerPath = normalizeTrim ( this . popplerPath ) ;
130+ this . popplerPath = normalize ( this . popplerPath ) ;
131131 }
132132
133133 /**
@@ -152,7 +152,7 @@ class Poppler {
152152 args . push ( file , fileToAttach , outputFile ) ;
153153
154154 const { stdout } = await execFileAsync (
155- joinSafe ( this . popplerPath , "pdfattach" ) ,
155+ pathResolve ( this . popplerPath , "pdfattach" ) ,
156156 args
157157 ) ;
158158 return Promise . resolve ( stdout ) ;
@@ -209,7 +209,7 @@ class Poppler {
209209 args . push ( file ) ;
210210
211211 const { stdout } = await execFileAsync (
212- joinSafe ( this . popplerPath , "pdfdetach" ) ,
212+ pathResolve ( this . popplerPath , "pdfdetach" ) ,
213213 args
214214 ) ;
215215 return Promise . resolve ( stdout ) ;
@@ -244,7 +244,7 @@ class Poppler {
244244
245245 try {
246246 const { stderr } = await execFileAsync (
247- joinSafe ( this . popplerPath , "pdffonts" ) ,
247+ pathResolve ( this . popplerPath , "pdffonts" ) ,
248248 [ "-v" ]
249249 ) ;
250250
@@ -257,7 +257,7 @@ class Poppler {
257257 args . push ( Buffer . isBuffer ( file ) ? "-" : file ) ;
258258
259259 const child = spawn (
260- joinSafe ( this . popplerPath , "pdffonts" ) ,
260+ pathResolve ( this . popplerPath , "pdffonts" ) ,
261261 args
262262 ) ;
263263
@@ -345,7 +345,7 @@ class Poppler {
345345
346346 try {
347347 const { stderr } = await execFileAsync (
348- joinSafe ( this . popplerPath , "pdfimages" ) ,
348+ pathResolve ( this . popplerPath , "pdfimages" ) ,
349349 [ "-v" ]
350350 ) ;
351351
@@ -362,7 +362,7 @@ class Poppler {
362362 }
363363
364364 const child = spawn (
365- joinSafe ( this . popplerPath , "pdfimages" ) ,
365+ pathResolve ( this . popplerPath , "pdfimages" ) ,
366366 args
367367 ) ;
368368
@@ -464,7 +464,7 @@ class Poppler {
464464
465465 try {
466466 const { stderr } = await execFileAsync (
467- joinSafe ( this . popplerPath , "pdfinfo" ) ,
467+ pathResolve ( this . popplerPath , "pdfinfo" ) ,
468468 [ "-v" ]
469469 ) ;
470470
@@ -489,7 +489,7 @@ class Poppler {
489489 }
490490
491491 const child = spawn (
492- joinSafe ( this . popplerPath , "pdfinfo" ) ,
492+ pathResolve ( this . popplerPath , "pdfinfo" ) ,
493493 args
494494 ) ;
495495
@@ -583,7 +583,7 @@ class Poppler {
583583
584584 try {
585585 const { stderr } = await execFileAsync (
586- joinSafe ( this . popplerPath , "pdfseparate" ) ,
586+ pathResolve ( this . popplerPath , "pdfseparate" ) ,
587587 [ "-v" ]
588588 ) ;
589589
@@ -594,7 +594,7 @@ class Poppler {
594594 args . push ( file , outputPattern ) ;
595595
596596 const { stdout } = await execFileAsync (
597- joinSafe ( this . popplerPath , "pdfseparate" ) ,
597+ pathResolve ( this . popplerPath , "pdfseparate" ) ,
598598 args
599599 ) ;
600600 return Promise . resolve ( stdout ) ;
@@ -767,7 +767,7 @@ class Poppler {
767767
768768 try {
769769 const { stderr } = await execFileAsync (
770- joinSafe ( this . popplerPath , "pdftocairo" ) ,
770+ pathResolve ( this . popplerPath , "pdftocairo" ) ,
771771 [ "-v" ]
772772 ) ;
773773
@@ -783,7 +783,7 @@ class Poppler {
783783 ) ;
784784
785785 const child = spawn (
786- joinSafe ( this . popplerPath , "pdftocairo" ) ,
786+ pathResolve ( this . popplerPath , "pdftocairo" ) ,
787787 args
788788 ) ;
789789
@@ -908,7 +908,7 @@ class Poppler {
908908
909909 try {
910910 const { stderr } = await execFileAsync (
911- joinSafe ( this . popplerPath , "pdftohtml" ) ,
911+ pathResolve ( this . popplerPath , "pdftohtml" ) ,
912912 [ "-v" ]
913913 ) ;
914914
@@ -925,7 +925,7 @@ class Poppler {
925925 }
926926
927927 const child = spawn (
928- joinSafe ( this . popplerPath , "pdftohtml" ) ,
928+ pathResolve ( this . popplerPath , "pdftohtml" ) ,
929929 args
930930 ) ;
931931
@@ -1109,7 +1109,7 @@ class Poppler {
11091109
11101110 try {
11111111 const { stderr } = await execFileAsync (
1112- joinSafe ( this . popplerPath , "pdftoppm" ) ,
1112+ pathResolve ( this . popplerPath , "pdftoppm" ) ,
11131113 [ "-v" ]
11141114 ) ;
11151115
@@ -1122,7 +1122,7 @@ class Poppler {
11221122 args . push ( Buffer . isBuffer ( file ) ? "-" : file , outputPath ) ;
11231123
11241124 const child = spawn (
1125- joinSafe ( this . popplerPath , "pdftoppm" ) ,
1125+ pathResolve ( this . popplerPath , "pdftoppm" ) ,
11261126 args
11271127 ) ;
11281128
@@ -1341,7 +1341,7 @@ class Poppler {
13411341
13421342 try {
13431343 const { stderr } = await execFileAsync (
1344- joinSafe ( this . popplerPath , "pdftops" ) ,
1344+ pathResolve ( this . popplerPath , "pdftops" ) ,
13451345 [ "-v" ]
13461346 ) ;
13471347
@@ -1357,7 +1357,7 @@ class Poppler {
13571357 ) ;
13581358
13591359 const child = spawn (
1360- joinSafe ( this . popplerPath , "pdftops" ) ,
1360+ pathResolve ( this . popplerPath , "pdftops" ) ,
13611361 args
13621362 ) ;
13631363
@@ -1491,7 +1491,7 @@ class Poppler {
14911491
14921492 try {
14931493 const { stderr } = await execFileAsync (
1494- joinSafe ( this . popplerPath , "pdftotext" ) ,
1494+ pathResolve ( this . popplerPath , "pdftotext" ) ,
14951495 [ "-v" ]
14961496 ) ;
14971497
@@ -1507,7 +1507,7 @@ class Poppler {
15071507 ) ;
15081508
15091509 const child = spawn (
1510- joinSafe ( this . popplerPath , "pdftotext" ) ,
1510+ pathResolve ( this . popplerPath , "pdftotext" ) ,
15111511 args
15121512 ) ;
15131513
@@ -1572,7 +1572,7 @@ class Poppler {
15721572
15731573 try {
15741574 const { stderr } = await execFileAsync (
1575- joinSafe ( this . popplerPath , "pdfunite" ) ,
1575+ pathResolve ( this . popplerPath , "pdfunite" ) ,
15761576 [ "-v" ]
15771577 ) ;
15781578
@@ -1586,7 +1586,7 @@ class Poppler {
15861586 args . push ( outputFile ) ;
15871587
15881588 const { stdout } = await execFileAsync (
1589- joinSafe ( this . popplerPath , "pdfunite" ) ,
1589+ pathResolve ( this . popplerPath , "pdfunite" ) ,
15901590 args
15911591 ) ;
15921592 return Promise . resolve ( stdout ) ;
0 commit comments