alanshaw / alanshaw/markdown-pdf
Parallel processing with one PhantomJS process?
- 主要語言
- JavaScript
- 星號
- 2.9k
- 分支
- 253
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Thanks for this wonderful module!
I use a promise-based approach to convert multiple markdowns in parallel, like so:
```js
const markdownpdf = require( 'markdown-pdf' )
const pdf = markdownpdf( )
const fs = require( 'fs' )
const mdtopdf = ( path, md ) => {
return new Promise( ( resolve, reject ) => {
// Check if pdf is already there
if( fs.existsSync( path ) ) resolve( 'File already exists' )
// If not, generate it
pdf.from.string( md, path ) )
.to( output, f => {
resolve( output )
} )
} )
}
const publishpdf = ( path, markdowns ) => {
return Promise.all( markdowns.map( md => mdtopdf( path, md ) ) )
}
```
This means that when I run my build there are a **lot** of PhantonJs processes that make my laptop go wonky (MBP just starts the fan, small MB buckles and freezes for a bit).
Is there a way to to parallel building using a single PhantomJs process? Perhaps by starting a Phantom instance and having the module hook into an already running instance?
edit: removed some useless context code
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。