dobo
Version:
Database ORM/ODM for Bajo Framework
12 lines (10 loc) • 372 B
JavaScript
async function remove (name, id, field, file, options = {}) {
const { fs } = this.lib
name = this.attachmentPreCheck(name)
if (!name) return
const path = await this.attachmentGetPath(name, id, field, file)
const { req } = options
await fs.remove(path)
if (req && req.flash) req.flash('notify', req.t('attachmentRemoved'))
}
export default remove