import * as fs from 'fs-extra' ; import * as path from 'path' ; export async function touch ( p ) { try { await fs . utimes ( p , new Date ( ) , new Date ( ) ) ; } catch { await fs . outputFile ( p , '' ) ; } } export async function ls ( dir ) { const files = await fs . readdir ( dir ) ; const paths = files . map ( f => path . join ( dir , f ) ) ; return Promise . all ( paths . map ( path => fs . stat ( path ) . then ( stat => ( { path , stat } ) ) ) ) ; } export function wait ( ms , unref = false ) { return new Promise ( resolve => { const t = setTimeout ( ( ) => resolve ( ) , ms ) ; if ( unref ) t . unref ( ) ; } ) ; }