File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
# x2j-cli
2
- Node.js command line script to convert xml input into json output (can be piped easily)
2
+
3
+ Node.js command line script to convert XML input into JSON output (can be piped easily)
4
+
5
+
6
+ ## Install
7
+
8
+ It requires Node (0.12 or higher) and Npm (2 or higher):
9
+
10
+ ``` bash
11
+ npm install --global x2j-cli
12
+ ```
Original file line number Diff line number Diff line change @@ -18,10 +18,12 @@ stdin.on('data', function (chunk) {
18
18
stdin . on ( 'end' , function ( ) {
19
19
xml2js . parseString ( content , ( err , parsedData ) => {
20
20
if ( err ) {
21
- return console . error ( err ) ;
21
+ console . error ( err ) ;
22
+ process . exit ( 1 ) ;
22
23
}
23
24
var outputJSON = JSON . stringify ( parsedData , null , 2 ) ;
24
25
stdout . write ( outputJSON ) ;
25
26
stdout . write ( '\n' ) ;
27
+ process . exit ( 0 ) ;
26
28
} ) ;
27
29
} ) ;
Original file line number Diff line number Diff line change 2
2
"name" : " x2j-cli" ,
3
3
"version" : " 1.0.0" ,
4
4
"description" : " Node.js command line script to convert xml input into json output (can be piped easily)" ,
5
+ "engines" : {
6
+ "node" : " >=0.12"
7
+ },
5
8
"main" : " index.js" ,
6
9
"bin" : {
7
10
"x2j" : " ./index.js"
You can’t perform that action at this time.
0 commit comments