File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -121,11 +121,14 @@ Type: `object`
121121
122122Request headers that will be passed to fetch/prerender process.
123123
124- ##### mutoolPath
124+ ##### mutool
125125
126- Type: ` function `
126+ Type: ` function ` |` boolean ` <br >
127+ Default: ` source code `
128+
129+ It returns a function that receives that executes [ mutool] ( https://mupdf.com/ ) binary for turning PDF files into HTML markup.
127130
128- It returns the path for [ mutool ] ( https://mupdf.com/ ) binary, used for turning PDF files into HTML markup .
131+ It can explicitly disabled passing ` false ` .
129132
130133##### prerender
131134
Original file line number Diff line number Diff line change 11'use strict'
22
3- const { defaultMutoolPath : getMutoolPath } = require ( '../src/index' )
43const { readFile, readdir } = require ( 'fs/promises' )
5- const $ = require ( 'tinyspawn ' )
4+ const { defaultMutool } = require ( '../src/index ' )
65const path = require ( 'path' )
76
87const OUTPUT = path . join ( __dirname , 'output.pdf' )
@@ -67,7 +66,7 @@ class Benchmark {
6766}
6867
6968const main = async ( ) => {
70- const mutoolPath = getMutoolPath ( )
69+ const mutool = defaultMutool ( )
7170
7271 const fixtures = await readdir ( path . join ( __dirname , 'fixtures' ) )
7372
@@ -81,11 +80,11 @@ const main = async () => {
8180 }
8281 } )
8382 . add ( 'write in memory' , async ( ) => {
84- const result = await $ ( ` ${ mutoolPath } draw -q -F html ${ filepath } ` )
83+ const result = await mutool ( filepath )
8584 return result . stdout
8685 } )
8786 . add ( 'write in file, read async' , async ( ) => {
88- await $ ( ` ${ mutoolPath } draw -q -F html -o ${ OUTPUT } ${ filepath } `)
87+ await mutool ( ` -o ${ OUTPUT } ${ filepath } `)
8988 return readFile ( OUTPUT , 'utf-8' )
9089 } )
9190 . run ( )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const getBrowserless = initBrowserless(test)
1111test ( 'disable if `mutool` is not installed' , async t => {
1212 const targetUrl = 'https://cdn.microlink.io/file-examples/sample.pdf'
1313 const { url, stats, html } = await getHTML ( targetUrl , {
14- mutoolPath : false ,
14+ mutool : false ,
1515 getBrowserless
1616 } )
1717
You can’t perform that action at this time.
0 commit comments