( schema: Schema.ConstraintDecoder<A, Environment>, options?: FileSchemaOptions | undefined )
| 802 | * @since 4.0.0 |
| 803 | */ |
| 804 | export const fileSchema = <A>( |
| 805 | schema: Schema.ConstraintDecoder<A, Environment>, |
| 806 | options?: FileSchemaOptions | undefined |
| 807 | ): Primitive<A> => { |
| 808 | const decode = Schema.decodeUnknownEffect(schema) |
| 809 | return makePrimitive( |
| 810 | "FileSchema", |
| 811 | Effect.fnUntraced(function*(filePath) { |
| 812 | const content = yield* fileParse(options).parse(filePath) |
| 813 | return yield* Effect.mapError( |
| 814 | decode(content), |
| 815 | (error) => options?.errorFormatter?.(error.issue) ?? error.toString() |
| 816 | ) |
| 817 | }) |
| 818 | ) |
| 819 | } |
| 820 | |
| 821 | /** |
| 822 | * Parses a single `key=value` pair into a record object. |
nothing calls this directly
no test coverage detected