import { access } from 'fs/promises' ; export async function invoke ( fn , handleError ? ) { try { return await fn ( ) ; } catch ( error ) { handleError ?. ( error ) ; } } export async function tap < T > ( value , callback ) { await callback ( value ) ; return value ; } export async function ensureExists ( path ) { try { await access ( path ) ; } catch ( error ) { throw new Error ( `Could not access ${ path }.` ) ; } }