Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_pdfviewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-09-01 10:02:37 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-09-01 10:28:41 +0300
commitc01d0ebd90d6e000a7050832a7bc683daeb2287d (patch)
tree57cb3cbaf00de5b4cb1420965f6fbaa614156d4a /pdfjs-get.js
parentc7ac29cb1dae5dd1cf99244dda7e42900b1f7027 (diff)
Add missing build files
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'pdfjs-get.js')
-rw-r--r--pdfjs-get.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/pdfjs-get.js b/pdfjs-get.js
new file mode 100644
index 0000000..c3b3876
--- /dev/null
+++ b/pdfjs-get.js
@@ -0,0 +1,32 @@
+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') }))