File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 6
6
var N3 = require ( 'n3' ) ,
7
7
fs = require ( 'fs' ) ,
8
8
N3Util = N3 . Util ,
9
- http = require ( 'http' ) ,
9
+ http = require ( 'http' ) ;
10
10
url = require ( 'url' ) ,
11
11
fs = require ( 'fs' ) ,
12
12
validate = require ( './lib/validator.js' ) ;
@@ -34,14 +34,22 @@ if (args.length === 0) {
34
34
} else if ( args . length > 0 ) {
35
35
// Create a stream from the file, whether it is a local file or a http stream
36
36
var parsedUrl = url . parse ( args [ 0 ] ) ;
37
- if ( parsedUrl . protocol === 'http:' )
37
+ switch ( parsedUrl . protocol ) {
38
+ case 'https:' :
39
+ http = require ( 'https' ) ;
40
+ case 'http:' :
38
41
http . get ( parsedUrl . href , function ( res ) {
39
42
validate ( res , showValidation ) ;
40
43
} ) . on ( 'error' , function ( e ) {
41
44
console . log ( "Got error: " + e . message ) ;
42
45
} ) ;
43
- else
46
+ break ;
47
+ case null :
44
48
validate ( fs . createReadStream ( parsedUrl . href ) , showValidation ) ;
49
+ break ;
50
+ default :
51
+ console . log ( 'Cannot access %s: "%s" not supported' , parsedUrl . href , parsedUrl . protocol )
52
+ }
45
53
}
46
54
47
55
// Use stdio as an input stream
You can’t perform that action at this time.
0 commit comments