| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/projects/nextcloud/apps/files_pdfviewer/ |
Upload File : |
const path = require('path')
const unzipper = require('unzipper')
const request = require('request')
const progress = require('request-progress')
const cliProgress = require('cli-progress')
// Fetching pdf.js build release
const PDFJSversion = '2.4.456'
console.info('Fetching pdfjs', PDFJSversion)
// Init progress
const pdfjsProgress = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic)
pdfjsProgress.start(100, 0)
progress(request(`https://github.com/mozilla/pdf.js/releases/download/v${PDFJSversion}/pdfjs-${PDFJSversion}-dist.zip`), {
throttle: 50,
delay: 0,
})
.on('progress', function(state) {
pdfjsProgress.update(state.size.transferred / state.size.total * 100)
})
.on('end', function() {
pdfjsProgress.update(100)
pdfjsProgress.stop()
console.info('Done! \n')
})
.on('error', function(err) {
console.error(err)
throw new Error('Unable to download pdfjs dist')
})
.pipe(unzipper.Extract({ path: path.resolve(__dirname, 'js', 'pdfjs') }))