-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDX Compilation is now functional! (as in, FP, not as in, working; that's been the case for a while)
- Loading branch information
Showing
3 changed files
with
141 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { type WalkEntry, type WalkOptions, walk } from "@std/fs"; | ||
import { type Cause, Effect, Stream } from "effect"; | ||
|
||
export const writeTextFile = ( | ||
path: string | URL, | ||
data: string | ReadableStream<string>, | ||
options?: Deno.WriteFileOptions, | ||
): Effect.Effect<void, Cause.UnknownException, never> => | ||
Effect.tryPromise(() => Deno.writeTextFile(path, data, options)); | ||
|
||
export const readTextFile = ( | ||
path: string | URL, | ||
options?: Deno.ReadFileOptions, | ||
): Effect.Effect<string, Cause.UnknownException, never> => | ||
Effect.tryPromise(() => Deno.readTextFile(path, options)); | ||
|
||
export const walkDir = <E>( | ||
root: string | URL, | ||
onError: (e: unknown) => E, | ||
walkOptions?: WalkOptions, | ||
): Stream.Stream<WalkEntry, E, never> => | ||
Stream.fromAsyncIterable(walk(root, walkOptions), onError); |