(path, options = kEmptyObject)
| 1636 | // converting to a Buffer is necessary in cases where the |
| 1637 | // to string conversion would fail. |
| 1638 | function fileURLToPathBuffer(path, options = kEmptyObject) { |
| 1639 | const windows = options?.windows; |
| 1640 | if (typeof path === 'string') { |
| 1641 | path = new URL(path); |
| 1642 | } else if (!isURL(path)) { |
| 1643 | throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); |
| 1644 | } |
| 1645 | if (path.protocol !== 'file:') { |
| 1646 | throw new ERR_INVALID_URL_SCHEME('file'); |
| 1647 | } |
| 1648 | return (windows ?? isWindows) ? getPathBufferFromURLWin32(path) : getPathBufferFromURLPosix(path); |
| 1649 | } |
| 1650 | |
| 1651 | function pathToFileURL(filepath, options = kEmptyObject) { |
| 1652 | const windows = options?.windows ?? isWindows; |
no test coverage detected
searching dependent graphs…