You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

11 lines
423 B

const {execSync} = require('child_process')
function convert( filename ){
if (filename.endsWith('.pdf')) {
execSync( 'convert '+filename+' '+filename+'.jpg', {cwd:'public'})
fetch('https://ntfy.benetou.fr/convertedwebdav', { method: 'POST', body: JSON.stringify({source: filename, extension: '.jpg' }) })
// could also update a file of conversions to keep track of provenance
}
}
module.exports.convert = convert