site-scan icon indicating copy to clipboard operation
site-scan copied to clipboard

修改 -j 无法输出jpg格式

Open ifeiwu opened this issue 7 years ago • 0 comments

lib/site-scan.js

// Take the screenshot try { await page.screenshot({ path: ${options.path}${fileName}.png, fullPage: options.full, omitBackground: options.transparent, type: options.jpeg ? 'jpeg' : 'png', quality: options.quality });
} catch(e) { console.log(chalk{red • Error taking screenshot of ${url}. Skipping...}); return; }

console.log(chalk{green ✔ Screenshot saved to ${fileName}.png});

改为

let image_type = options.jpeg ? 'jpeg' : 'png';

// Take the screenshot try { await page.screenshot({ path: ${options.path}${fileName}.${image_type}, fullPage: options.full, omitBackground: options.transparent, type: image_type, quality: options.quality });
} catch(e) { console.log(chalk{red • Error taking screenshot of ${url}. Skipping...}); return; }

console.log(chalk{green ✔ Screenshot saved to ${fileName}.${image_type}});

ifeiwu avatar Jan 01 '19 02:01 ifeiwu