MCPcopy Create free account
hub / github.com/VemtoOrg/vemto2 / deleteFolder

Method deleteFolder

src/main/base/FileSystem.ts:153–168  ·  view source on GitHub ↗
(folderPath: string, allowed = false, log = true)

Source from the content-addressed store, hash-verified

151 }
152
153 deleteFolder(folderPath: string, allowed = false, log = true): FileSystem {
154 if(!allowed) {
155 throw new Error('It is necessary to manually allow to remove a folder through Vemto')
156 }
157
158 if(this.folderIsRestrict(folderPath)) {
159 throw new Error('Attempt to delete a restricted directory')
160 }
161
162 if(fs.existsSync(folderPath)) {
163 if(log) console.log('Removing Folder: ' + folderPath)
164 fs.rmdirSync(folderPath, { recursive: true })
165 }
166
167 return this
168 }
169
170 folderIsRestrict(folderPath: string) {
171 const absolutePath = path.resolve(folderPath)

Callers

nothing calls this directly

Calls 2

folderIsRestrictMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected