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

Function rm

packages/@contentlayer/utils/src/fs-in-memory.ts:140–157  ·  view source on GitHub ↗
(
  path: string,
  params: { force?: boolean; recursive?: boolean } = {},
)

Source from the content-addressed store, hash-verified

138): T.Effect<OT.HasTracer, RmError | FileOrDirNotFoundError, void>
139
140export 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected