Add --jobs option for the convert command
This doesn't seem that helpful as there seems to be a lot of sequential work going on regardless.
This commit is contained in:
parent
e3218f1658
commit
4386d48021
2 changed files with 10 additions and 3 deletions
|
|
@ -6,12 +6,12 @@ const serializeToXML = require("xmlserializer").serializeToString;
|
|||
const { JSDOM } = require("jsdom");
|
||||
const substitutions = require("./substitutions.json");
|
||||
|
||||
module.exports = async (cachePath, manifestPath, contentPath) => {
|
||||
module.exports = async (cachePath, manifestPath, contentPath, concurrentJobs) => {
|
||||
const manifestContents = await fs.readFile(manifestPath, { encoding: "utf-8" });
|
||||
const chapters = JSON.parse(manifestContents);
|
||||
console.log("All chapters downloaded; beginning conversion to EPUB chapters");
|
||||
|
||||
const mapper = throat(10, chapter => convertChapter(chapter, cachePath, contentPath));
|
||||
const mapper = throat(concurrentJobs, chapter => convertChapter(chapter, cachePath, contentPath));
|
||||
await Promise.all(chapters.map(mapper));
|
||||
|
||||
console.log("All chapters converted");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue