UNPKG

@alancnet/ftp-srv

Version:

Modern, extensible FTP Server

21 lines (18 loc) 547 B
const Promise = require('bluebird'); module.exports = { directive: 'DELE', handler: function ({log, command} = {}) { if (!this.fs) return this.reply(550, 'File system not instantiated'); if (!this.fs.delete) return this.reply(402, 'Not supported by file system'); return Promise.resolve(this.fs.delete(command.arg)) .then(() => { return this.reply(250); }) .catch(err => { log.error(err); return this.reply(550, err.message); }); }, syntax: '{{cmd}} <path>', description: 'Delete file' };