MCPcopy Create free account
hub / github.com/effect-app/libs / toFileUrl

Function toFileUrl

repos/effect/packages/effect/src/Path.ts:440–453  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

438 const outURL = new URL("file://")
439 let resolved = resolve(filepath)
440 // path.resolve strips trailing slashes so we must add them back
441 const filePathLast = filepath.charCodeAt(filepath.length - 1)
442 if (
443 (filePathLast === CHAR_FORWARD_SLASH) &&
444 resolved[resolved.length - 1] !== "/"
445 ) {
446 resolved += "/"
447 }
448 outURL.pathname = encodePathChars(resolved)
449 return Effect.succeed(outURL)
450}
451
452const percentRegExp = /%/g
453const backslashRegExp = /\\/g
454const newlineRegExp = /\n/g
455const carriageReturnRegExp = /\r/g
456const tabRegExp = /\t/g

Callers

nothing calls this directly

Calls 3

encodePathCharsFunction · 0.85
resolveFunction · 0.70
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…