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

Function writeFile

packages/platform/node-shared/src/NodeFileSystem.ts:743–760  ·  view source on GitHub ↗
(path, data, options)

Source from the content-addressed store, hash-verified

741// == writeFile
742
743const writeFile: FileSystem.FileSystem["writeFile"] = (path, data, options) =>
744 Effect.callback<void, Error.PlatformError>((resume, signal) => {
745 try {
746 NFS.writeFile(path, data, {
747 signal,
748 flag: options?.flag,
749 mode: options?.mode
750 }, (err) => {
751 if (err) {
752 resume(Effect.fail(handleErrnoException("FileSystem", "writeFile")(err, [path])))
753 } else {
754 resume(Effect.void)
755 }
756 })
757 } catch (err) {
758 resume(Effect.fail(handleBadArgument("writeFile")(err)))
759 }
760 })
761
762const makeFileSystem = Effect.map(Effect.serviceOption(FileSystem.WatchBackend), (backend) =>
763 FileSystem.make({

Callers 2

makeTempFileFactoryFunction · 0.70

Calls 4

handleErrnoExceptionFunction · 0.90
handleBadArgumentFunction · 0.85
failMethod · 0.65
resumeFunction · 0.50

Tested by

no test coverage detected