MCPcopy
hub / github.com/Effect-TS/effect / toFileUrl

Function toFileUrl

packages/platform/src/internal/path.ts:194–207  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

192const CHAR_FORWARD_SLASH = 47
193
194function toFileUrl(filepath: string) {
195 const outURL = new URL("file://")
196 let resolved = resolve(filepath)
197 // path.resolve strips trailing slashes so we must add them back
198 const filePathLast = filepath.charCodeAt(filepath.length - 1)
199 if (
200 (filePathLast === CHAR_FORWARD_SLASH) &&
201 resolved[resolved.length - 1] !== "/"
202 ) {
203 resolved += "/"
204 }
205 outURL.pathname = encodePathChars(resolved)
206 return Effect.succeed(outURL)
207}
208
209const percentRegEx = /%/g
210const backslashRegEx = /\\/g

Callers

nothing calls this directly

Calls 2

resolveFunction · 0.85
encodePathCharsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…