(filePath)
| 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)) { |
no test coverage detected