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

Function open

packages/platform/deno/src/DenoFileSystem.ts:364–380  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

362}
363
364const open: FileSystem.FileSystem["open"] = (path, options) => {
365 if (options?.noFollow === true) {
366 return Effect.fail(PlatformError.badArgument({
367 module: "FileSystem",
368 method: "open",
369 description: "noFollow is not supported by Deno"
370 }))
371 }
372 const append = options?.flag?.startsWith("a") ?? false
373 return Effect.map(
374 Effect.acquireRelease(
375 tryPromise("open", path, () => Deno.open(path, openOptions(options?.flag, options?.mode))),
376 (file) => close(file, "open", path)
377 ),
378 (file) => new FileImpl(file, append)
379 )
380}
381
382const makeTempFileFactory = (method: string): FileSystem.FileSystem["makeTempFile"] => (options) =>
383 tryPromise(method, options?.directory, () =>

Callers 1

layerTaskFunction · 0.50

Calls 6

openOptionsFunction · 0.85
tryPromiseFunction · 0.70
closeFunction · 0.70
failMethod · 0.65
mapMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected