@zzzen/screenshoter
v1.1.2
Published
```bash npm i @zzzen/screenshoter ```
Downloads
1
Readme
安装
npm i @zzzen/screenshoter
使用
- 简单用法
const screenshoter = require('@zzzen/screenshoter')
const fs = require('fs')
// timeout为最大等待网页加载时间
screenshoter.crawlPage("http://google.com", { timeout: 10 * 1000 })
.subscribe(result => {
fs.writeFileSync('./test.jpg', result.image)
fs.writeFileSync('./test.html', result.mainHTML)
}, error => {
console.log(error)
})
// 也可以打印内部日志
screenshoter.setLogger((...msg) => {
fs.appendFileSync('./log.txt', JSON.stringify(msg) + '\n')
})