MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / rm

Function rm

packages/@contentlayer/utils/src/node/fs.ts:142–159  ·  view source on GitHub ↗
(
  path: string,
  params: { force?: boolean; recursive?: boolean } = {},
)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

rmMethod · 0.80

Tested by

no test coverage detected