(path, options = kEmptyObject)
| 1620 | } |
| 1621 | |
| 1622 | function fileURLToPath(path, options = kEmptyObject) { |
| 1623 | const windows = options?.windows; |
| 1624 | if (typeof path === 'string') |
| 1625 | path = new URL(path); |
| 1626 | else if (!isURL(path)) |
| 1627 | throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); |
| 1628 | if (path.protocol !== 'file:') |
| 1629 | throw new ERR_INVALID_URL_SCHEME('file'); |
| 1630 | return (windows ?? isWindows) ? getPathFromURLWin32(path) : getPathFromURLPosix(path); |
| 1631 | } |
| 1632 | |
| 1633 | // An alternative to fileURLToPath that outputs a Buffer |
| 1634 | // instead of a string. The other fileURLToPath does not |
no test coverage detected
searching dependent graphs…