UNPKG

ftp-srv-esm

Version:

Modern, extensible FTP server (daemon) for Node.js with ESM support. Based on ftp-srv.

22 lines (20 loc) 618 B
export default { directive: 'SIZE', handler: function ({log, command} = {}) { if (!this.fs) return this.reply(550, 'File system not instantiated'); if (!this.fs.get) return this.reply(402, 'Not supported by file system'); return Promise.resolve().then(() => this.fs.get(command.arg)) .then((fileStat) => { return this.reply(213, {message: fileStat.size}); }) .catch((err) => { log.error(err); return this.reply(550, err.message); }); }, syntax: '{{cmd}} <path>', description: 'Return the size of a file', flags: { feat: 'SIZE' } };