Skip to content

Function: normalizeFileSystemRoot()

normalizeFileSystemRoot(root?): string

Turn root into a POSIX filesystem root:

  1. Expand one-or-many input segments
  2. Strings split on / (and \); objects/arrays FNV-hash as one piece
  3. Each resulting component that cannot be a path component - see {@link UNSAFE_PATH_SEGMENT} - is replaced with {@link hash.fnvHash}
  4. Join with / and run posixPath.normalizeRoot

Defaults to /. A leading / on the first string segment is preserved.

FileSystemRootInput

string

normalizeFileSystemRoot("/cool/wow"); // "/cool/wow"
normalizeFileSystemRoot("/Users/me@corp.com/My Notes"); // unchanged
normalizeFileSystemRoot(["/path", { user: 1 }, true]); // "/path/<hash>/true"