MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / deleteDocument

Method deleteDocument

lib/ldp.mjs:553–571  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

551
552 // delete document (resource with acl and meta links)
553 async deleteDocument (filePath) {
554 const linkPath = this.resourceMapper._removeDollarExtension(filePath)
555 try {
556 // first delete file, then links with write permission only (atomic delete)
557 await withLock(filePath, () => promisify(fs.unlink)(filePath))
558
559 const aclPath = `${linkPath}${this.suffixAcl}`
560 if (await promisify(fs.exists)(aclPath)) {
561 await withLock(aclPath, () => promisify(fs.unlink)(aclPath))
562 }
563 const metaPath = `${linkPath}${this.suffixMeta}`
564 if (await promisify(fs.exists)(metaPath)) {
565 await withLock(metaPath, () => promisify(fs.unlink)(metaPath))
566 }
567 } catch (err) {
568 debug.container('DELETE -- unlink() error: ' + err)
569 throw error(err, 'Failed to delete resource')
570 }
571 }
572
573 async copy (from, to, options) {
574 if (overQuota(this.quotaFile, this.quota)) {

Callers 1

deleteMethod · 0.95

Calls 2

withLockFunction · 0.85

Tested by

no test coverage detected