11#!/usr/bin/env node
22// wcsc.exe md5 = "3999c590c57c764b152bc6db3b3288c4"
3- const version = "20220308"
3+ const version = "20220308" ;
44const { spawn } = require ( "child_process" ) ;
55const path = require ( "path" ) ;
66const args = process . argv . slice ( 2 ) ;
7- const wcscPath = path . resolve ( __dirname , "./wcsc.bin" )
7+ const wcscPath = path . resolve ( __dirname , "./wcsc.bin" ) ;
88
99function encode1 ( s ) {
1010 return encodeURI ( s ) . replace (
@@ -28,7 +28,9 @@ if (args.includes("-ll")) {
2828 } ) ;
2929 wcsc . on ( "close" , ( n ) => {
3030 if ( 0 === n ) {
31- const str = Buffer . concat ( spwanData ) . toString ( ) . replace ( / \\ \\ / g, '\\\\u005c' ) ;
31+ const str = Buffer . concat ( spwanData )
32+ . toString ( )
33+ . replace ( / \\ \\ / g, "\\\\u005c" ) ;
3234 const resultSplit = encode1 ( str ) . split ( "=" ) ;
3335 const tempObj = { } ;
3436 for (
@@ -62,21 +64,20 @@ if (args.includes("-ll")) {
6264 result = result . replace ( / \\ \\ / g, "\\" ) ;
6365 result = result . replace ( / \\ [ \s \S ] { 1 } / gi, function ( 0ドル , 1ドル , 2ドル ) {
6466 const c = 0ドル === "\\n" ? "\n" : 0ドル [ 1 ] ;
65- return "\\u" + c . charCodeAt ( 0 ) . toString ( 16 ) . padStart ( 4 , "0" )
66- } )
67+ return "\\u" + c . charCodeAt ( 0 ) . toString ( 16 ) . padStart ( 4 , "0" ) ;
68+ } ) ;
6769 process . stdout . write ( result ) ;
68- } else {
70+ } else {
6971 process . stderr . write ( Buffer . concat ( errData ) . toString ( ) ) ;
70- process . exitCode = n
72+ process . exitCode = n ;
7173 }
7274 } ) ;
73- 7475} else {
7576 const wcsc = spawn ( wcscPath , args , {
7677 cwd : process . cwd ( ) ,
7778 stdio : "inherit" ,
7879 } ) ;
79- wcsc . on ( ' close' , code => {
80- process . exitCode = code
81- } )
80+ wcsc . on ( " close" , ( code ) => {
81+ process . exitCode = code ;
82+ } ) ;
8283}
0 commit comments