import fs from 'fs' ; import readline from 'readline' ; import map from 'lodash/map' ; export const parseAndProcessFiles = async ( fileNames , processFunc , onProgress ) => Promise . all ( map ( fileNames , ( fileName ) => new Promise ( ( resolve ) => { const RL = readline . createInterface ( { terminal : false , input : fs . createReadStream ( fileName ) , } ) ; RL . on ( 'line' , ( line ) => { processFunc ( line ) ; } ) ; RL . on ( 'close' , ( ) => { onProgress ( ) ; resolve ( ) ; } ) ; } ) ) ) ;