(
method: string,
key: string,
f: (path: string) => Effect.Effect<A, PlatformError.PlatformError>
)
| 198 | const fs = yield* FileSystem.FileSystem |
| 199 | const path = yield* Path.Path |
| 200 | const withKeyPath = <A>( |
| 201 | method: string, |
| 202 | key: string, |
| 203 | f: (path: string) => Effect.Effect<A, PlatformError.PlatformError> |
| 204 | ): Effect.Effect<A, PlatformError.PlatformError> => |
| 205 | key.length === 0 || key === "." || key === ".." |
| 206 | ? Effect.fail( |
| 207 | new PlatformError.BadArgument({ |
| 208 | module: "KeyValueStore", |
| 209 | method, |
| 210 | description: "Key must not be empty, . or .." |
| 211 | }) |
| 212 | ) |
| 213 | : f(path.join(directory, encodeURIComponent(key))) |
| 214 | |
| 215 | if (!(yield* fs.exists(directory))) { |
| 216 | yield* fs.makeDirectory(directory, { recursive: true }) |
no test coverage detected