Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 1x | import {Paths} from '#codec'
import {type Tree} from '#tree'
import {FileSystem, Path} from '@effect/platform'
import {Effect} from 'effect'
import type {DirectoryEffect} from './types.js'
/**
* @category filesystem
* @function
*/
export const writeDirectoryTree = (
self: Tree<string>,
mode?: number,
): DirectoryEffect<void> =>
Effect.gen(function* () {
const path = yield* Path.Path
const fs = yield* FileSystem.FileSystem
for (const p of Paths.encode(self)) {
yield* fs.makeDirectory(path.join(...p), {
/* v8 ignore next 1 */
...(mode !== undefined && {mode}),
recursive: true,
})
}
})
|