2021-10-22 22:21:38 +00:00
|
|
|
#!/usr/bin/node
|
|
|
|
|
2022-11-06 17:28:58 +00:00
|
|
|
import Pageres from 'pageres'
|
2021-10-22 22:21:38 +00:00
|
|
|
|
|
|
|
async function captureUrl () {
|
2022-01-12 23:13:09 +00:00
|
|
|
try {
|
2022-11-06 17:28:58 +00:00
|
|
|
const streams = await new Pageres({ crop: true, scale: 2, timeout: 10, launchOptions: { args: ['--single-process'] } })
|
|
|
|
.source(process.argv[2], ['600x315'])
|
2022-01-12 23:13:09 +00:00
|
|
|
.run()
|
|
|
|
process.stdout.write(streams[0], () => process.exit(0))
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e)
|
|
|
|
process.exit(1)
|
|
|
|
}
|
2021-10-22 22:21:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
captureUrl()
|