MCPcopy Create free account
hub / github.com/Effect-TS/effect / fileUrlOps

Function fileUrlOps

packages/platform/node-shared/src/NodePath.ts:18–39  ·  view source on GitHub ↗
(windows: boolean | undefined)

Source from the content-addressed store, hash-verified

16import * as NodeUrl from "node:url"
17
18const fileUrlOps = (windows: boolean | undefined) => ({
19 fromFileUrl: (url: URL): Effect.Effect<string, BadArgument> =>
20 Effect.try({
21 try: () => NodeUrl.fileURLToPath(url, { windows }),
22 catch: (cause) =>
23 new BadArgument({
24 module: "Path",
25 method: "fromFileUrl",
26 cause
27 })
28 }),
29 toFileUrl: (path: string): Effect.Effect<URL, BadArgument> =>
30 Effect.try({
31 try: () => NodeUrl.pathToFileURL(path, { windows }),
32 catch: (cause) =>
33 new BadArgument({
34 module: "Path",
35 method: "toFileUrl",
36 cause
37 })
38 })
39})
40
41/**
42 * Provides the `Path` service using Node's POSIX path implementation plus

Callers 1

NodePath.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected