-// GPLv3 License
const fs = require("fs")
const download = require("download")
const cliProgress = require("cli-progress")
const chapters = 124
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.legacy)
-bar.start(chapters, 0, { speed: "N/A" })
+bar.start(chapters, 0, {speed: "N/A"})
const doc = new pdfkit({autoFirstPage: false})
doc.pipe(fs.createWriteStream("Horimiya.pdf"))
.fill(null)
.map((_, i) => i + 1)
.map(n => download(url + n)
- .pipe(unzipper.Extract({ path: "pages" }))
+ .pipe(unzipper.Extract({path: "pages"}))
.promise()
.then(_ => bar.increment())
)
.then(_ => bar.stop())
.then(_ => fs.promises.readdir("pages"))
.then(files => files
- .sort(new Intl.Collator(undefined, { numeric: true }).compare)
+ .sort(new Intl.Collator(undefined, {numeric: true}).compare)
.map(file => "pages/" + file)
.map(file => doc.openImage(file))
.forEach(img => doc.addPage({size: [img.width, img.height]}).image(img, 0, 0))
"description": "Horimiya Manga downloader",
"main": "init.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "start": "node init.js"
},
"repository": {
"type": "git",