Documentation for Simbo's Packages
    Preparing search index...
    • Deriving absolute directory or file path from import.meta with a consistent fallback order.

      This function is Node.js-only and expects the url property to be a file: URL.

      For type 'dir', the fallback order is:

      1. importMeta.dirname (if present)
      2. dirname(importMeta.filename) (if present)
      3. dirname(fileURLToPath(importMeta.url))

      For type 'file', the fallback order is:

      1. importMeta.filename (if present)
      2. fileURLToPath(importMeta.url)

      Parameters

      • importMeta: ImportMetaObject

        An object resembling import.meta, containing at least a url property as a file: URL.

      • type: "dir" | "file" = 'dir'

        The type of path to retrieve: 'dir' for directory or 'file' for file path. Defaults to 'dir'.

      Returns string

      The derived directory or file path as a string.

      If the type argument is not 'dir' or 'file'.