nl_tokens: / * function dumpingDatabase that create a json dump file of all the content of the database ( name in config . json ) Using the curl command for this operation . If the - p flag is specified in command line we construct the curl commande without the proxy server .
pl_tokens: function dumpingDatabase ( testDump = false ) { let dumpEmitter = new EventEmitter ( ) ; let wstream ; if ( testDump ) { wstream = fs . createWriteStream ( ` ${ nameDB } ` ) ; } else { wstream = fs . createWriteStream ( ` ${ nameDB } ` ) ; } let chunkRes = '' ; let chunkError = '' ; let curl ; if ( proxyBool ) { curl = child_process_1 . spawn ( 'curl' , [ '--noproxy' , ` ${ addressDB } ` , ` ` , ` ` , ` ${ accountDB } ${ passwordDB } ${ addressDB } ${ portDB } ${ nameDB } ` ] ) ; } else { curl = child_process_1 . spawn ( 'curl' , [ ` ` , ` ` , ` ${ accountDB } ${ passwordDB } ${ addressDB } ${ portDB } ${ nameDB } ` ] ) ; } curl . stdout . on ( 'data' , ( data ) => { chunkRes += data . toString ( 'utf8' ) ; } ) ; curl . stderr . on ( 'data' , ( data ) => { chunkError += data . toString ( 'utf8' ) ; } ) ; curl . on ( 'close' , ( code ) => { let split = chunkError . replace ( / (\r\n\t|\n|\r\t) / gm , " " ) . <mask> ( " " ) ; if ( chunkError . length > 0 && chunkRes . length === 0 ) { logger_1 . logger . log ( 'error' , ` ${ nameDB } \n ${ chunkError } ` ) ; } else { try { wstream . write ( chunkRes ) ; if ( testDump ) logger_1 . logger . log ( 'success' , ` ${ nameDB } ${ nameDB } ` ) ; else logger_1 . logger . log ( 'success' , ` ${ nameDB } ${ nameDB } ` ) ; dumpEmitter . emit ( 'dumpDone' ) ; } catch ( err ) { logger_1 . logger . log ( 'error' , ` ${ nameDB } \n ${ err } ` ) ; dumpEmitter . emit ( 'dumpFailed' , err ) ; } } } ) ; return dumpEmitter ; }