File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const { URL } = require ( 'url' )
4
+ const termImg = require ( 'term-img' )
4
5
5
6
const createBrowserless = require ( '..' )
6
7
const browserless = createBrowserless ( )
@@ -9,12 +10,16 @@ const url = new URL(process.argv[2])
9
10
; ( async ( ) => {
10
11
const tmpStream = await browserless . screenshot ( url . toString ( ) , {
11
12
tmpOpts : {
12
- path : './' ,
13
13
name : `${ url . hostname } .${ Date . now ( ) } `
14
14
}
15
15
} )
16
16
17
- const filepath = tmpStream . path
18
- console . log ( filepath )
19
- process . exit ( )
17
+ try {
18
+ termImg ( tmpStream . path )
19
+ await tmpStream . cleanup ( )
20
+ process . exit ( )
21
+ } catch ( err ) {
22
+ console . log ( `Screenshot saved at '${ tmpStream . path } '` )
23
+ process . exit ( )
24
+ }
20
25
} ) ( )
Original file line number Diff line number Diff line change 59
59
"standard" : " latest" ,
60
60
"standard-markdown" : " latest" ,
61
61
"string-to-stream" : " latest" ,
62
+ "term-img" : " latest" ,
62
63
"time-span" : " latest"
63
64
},
64
65
"engines" : {
You can’t perform that action at this time.
0 commit comments