nl_tokens: / * Indexation goal is to retrieve the array of caches directory . Find all jobID . json file with their IDs and add them into couchDB database .
pl_tokens: function indexation ( cacheArray ) { let emitterIndex = new EventEmitter ( ) ; let pathResult = globCaches ( cacheArray ) ; // Adding "_id" key to all jobID.json content from pathResult. // directorySearch function return the name of the directory (uuid) that contain the jobID.json file. let dataToCouch = [ ] ; for ( let path of pathResult ) { let <mask> = extractDoc ( path , directorySearch ( path ) ) ; result && dataToCouch . push ( result ) ; // this method remove "0" but we don't have "0" so it's OK } if ( program . test ) logger_1 . logger . log ( 'success' , '----> OK' ) ; logger_1 . logger . log ( 'info' , ` ${ dataToCouch . length } ` ) ; logger_1 . logger . log ( 'debug' , ` ${ JSON . stringify ( dataToCouch ) } ` ) ; dbMod . addToDB ( dataToCouch , nameDB , accountDB , passwordDB , addressDB , portDB , proxyBool ) . then ( ( ) => { logger_1 . logger . log ( 'success' , ` ${ dataToCouch . length } ${ nameDB } ` ) ; emitterIndex . emit ( 'indexDone' ) ; } ) . catch ( ( err ) => { emitterIndex . emit ( 'indexError' , err ) ; } ) ; return emitterIndex ; }