alanshaw / alanshaw/markdown-pdf
Parallel processing with one PhantomJS process?
- Ngôn ngữ chính
- JavaScript
- Star
- 2.9k
- Fork
- 253
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.