(method: string)
| 168 | // == open |
| 169 | |
| 170 | const openFactory = (method: string) => { |
| 171 | const nodeOpen = effectify( |
| 172 | NFS.open, |
| 173 | handleErrnoException("FileSystem", method), |
| 174 | handleBadArgument(method) |
| 175 | ) |
| 176 | const nodeClose = effectify( |
| 177 | NFS.close, |
| 178 | handleErrnoException("FileSystem", method), |
| 179 | handleBadArgument(method) |
| 180 | ) |
| 181 | |
| 182 | return (path: string, options?: FileSystem.OpenFileOptions) => |
| 183 | pipe( |
| 184 | Effect.acquireRelease( |
| 185 | nodeOpen(path, options?.flag ?? "r", options?.mode), |
| 186 | (fd) => Effect.orDie(nodeClose(fd)) |
| 187 | ), |
| 188 | Effect.map((fd) => makeFile(FileSystem.FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)) |
| 189 | ) |
| 190 | } |
| 191 | const open = openFactory("open") |
| 192 | |
| 193 | const makeFile = (() => { |
no test coverage detected
searching dependent graphs…