fast-fs-hash - v0.0.0-rc4
    Preparing search index...

    Function toRelativePath

    • Resolve filePath relative to rootPath and return a clean unix-style relative path, or null if the file is outside the root.

      • Handles both absolute and relative input paths.
      • Resolves . and .. segments via path.resolve.
      • Converts backslashes to forward slashes on Windows.
      • On POSIX, backslashes are preserved (they are valid in filenames).
      • Strips any leading ./.
      • Returns null for paths that resolve outside rootPath.
      • Returns null for empty strings.

      Parameters

      • rootPath: string

        Already-resolved absolute root directory.

      • filePath: string

        Absolute or relative file path to normalize.

      Returns string | null

      Clean unix relative path (e.g. "src/index.ts"), or null.