import Fs from 'fs' ; import * as Rx from 'rxjs' ; import { mergeMap , map , catchError } from 'rxjs/operators' ; import { allValuesFrom } from '../common' ; const stat$ = Rx . bindNodeCallback < Fs . PathLike , Fs . Stats > ( Fs . stat ) ; /**
 * get mtimes of referenced paths concurrently, limit concurrency to 100
 */ export async function getMtimes ( paths ) { return new Map ( await allValuesFrom ( Rx . from ( paths ) . pipe ( mergeMap ( ( path ) => stat$ ( path ) . pipe ( map ( ( stat ) => [ path , stat . mtimeMs ] as const ) , catchError ( ( error ) => error ?. code === 'ENOENT' ? Rx . EMPTY : Rx . throwError ( error ) ) ) , 100 ) ) ) ) ; }