Socket
Book a DemoInstallSign in
Socket

ensure-path-cached

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensure-path-cached

native ES6 ESM module, ensures path exits, shortcut for ensuring periodic dir, uses cache to avoid unnecessarily accessing remote fs, i.e., NFS/EFS

1.1.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

ensure-path-cached

  • native ESM, type: module (.mjs)
  • Ensures pre-existing dirs already exists
  • Ensures path to create exists or creates it
  • Periodic dir specified with Luxon format string
  • Caches path:dir with TTL and maxEntries avoiding unnecessarily filesystem access

Usage

import EnsurePathCached from 'ensure-path-cached.mjs'

const ensurePathCached = new EnsurePathCached()

try {
  // preExistingPath is optional and defaults to process.cwd()
  await ensurePathCached.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>
   */
  await ensurePathCached.ensurePeriodicDirAtPathExists(properties)
} catch (e) {
  // handle error
}

Periodic date time string format

Keywords

ensure

FAQs

Package last updated on 21 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.