Documentation
¶
Overview ¶
Package nodepath converts path inputs the way upstream's Node runtime does on the platform orb runs on: url.fileURLToPath, url.pathToFileURL, and the win32 Git Bash/MSYS drive-path rewrite from upstream utils/paths.ts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidURL = errors.New("Invalid URL") //nolint:staticcheck // Node's error text. ErrURIMalformed = errors.New("URI malformed") )
Node's error messages for rejected file URLs (ERR_INVALID_URL, URIError, ERR_INVALID_FILE_URL_PATH); their text is observable, capitals included.
Functions ¶
func FileURLToPath ¶
FileURLToPath parses raw with the WHATWG rules for the file scheme and converts it like Node's url.fileURLToPath: POSIX rejects hosts, win32 maps them to UNC paths and requires a drive letter otherwise.
func HostPathToPath ¶
HostPathToPath converts the host and percent-encoded pathname of an already parsed file URL; host must already be "" for localhost.
func NormalizeShellPath ¶
NormalizeShellPath rewrites Git Bash, MSYS, Cygwin and WSL drive paths ("/c/x", "/mnt/c/x", "/cygdrive/c/x") to native drive paths on win32 and returns path unchanged elsewhere.
func NormalizeUnicodeSpaces ¶ added in v0.14.0
NormalizeUnicodeSpaces folds pasted path spacing without changing other whitespace.
func PathToFileURL ¶
PathToFileURL encodes an absolute native path like Node's url.pathToFileURL.
Types ¶
This section is empty.