(
path: string,
params: { force?: boolean; recursive?: boolean } = {},
)
| 138 | ): T.Effect<OT.HasTracer, RmError | FileOrDirNotFoundError, void> |
| 139 | |
| 140 | export function rm( |
| 141 | path: string, |
| 142 | params: { force?: boolean; recursive?: boolean } = {}, |
| 143 | ): T.Effect<OT.HasTracer, RmError | FileOrDirNotFoundError, void> { |
| 144 | const { force = false, recursive = true } = params |
| 145 | return OT.withSpan('rm', { attributes: { path } })( |
| 146 | T.tryCatch( |
| 147 | () => fs.rmSync(path, { recursive, force }), |
| 148 | (error: any) => { |
| 149 | if (error.code === 'ENOENT') { |
| 150 | return new FileOrDirNotFoundError({ path }) |
| 151 | } else { |
| 152 | return new RmError({ path, error }) |
| 153 | } |
| 154 | }, |
| 155 | ), |
| 156 | ) |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * NOTE: symlinks are not supported widely on Windows |
nothing calls this directly
no outgoing calls
no test coverage detected