Caches path:dir with TTL and maxEntries avoiding unnecessarily filesystem access
Usage
importEnsurePathCachedfrom'ensure-path-cached.mjs'constensurePathCached=newEnsurePathCached()try{// preExistingPath is optional and defaults to process.cwd()awaitensurePathCached.ensurePathExists(pathPrefixToCreate,preExistingPath)/* * OR * * <pre> * properties = { * preExistingPathPrefix: <String>, // optional path prefix must exist and must not end with / or throws Error, default process.cwd() * pathPrefixToCreate: '/fubar', // optional path relative to preExistingPath must start with /, default '' * date: <Date>, // optional date for computing periodic dir, default now in UTC * dateTimeFormatString: 'yyyyMMdd', // optional luxon format string, default yyyyMMdd * } * </pre> */awaitensurePathCached.ensurePeriodicDirAtPathExists(properties)}catch(e){// handle error}