MCPcopy Index your code
hub / github.com/nodejs/node / fileURLToPathBuffer

Function fileURLToPathBuffer

lib/internal/url.js:1638–1649  ·  view source on GitHub ↗
(path, options = kEmptyObject)

Source from the content-addressed store, hash-verified

1636// converting to a Buffer is necessary in cases where the
1637// to string conversion would fail.
1638function 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
1651function pathToFileURL(filepath, options = kEmptyObject) {
1652 const windows = options?.windows ?? isWindows;

Callers 1

Calls 3

isURLFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…