stacker.news/spawn/capture.js

18 lines
403 B
JavaScript
Raw Normal View History

#!/usr/bin/node
2022-11-06 17:28:58 +00:00
import Pageres from 'pageres'
async function captureUrl () {
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'])
.run()
process.stdout.write(streams[0], () => process.exit(0))
} catch (e) {
console.log(e)
process.exit(1)
}
}
captureUrl()