UNPKG

ftp-srv-esm

Version:

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

17 lines (14 loc) 527 B
export default function ({log, command} = {}) { if (!this.fs) return this.reply(550, 'File system not instantiated'); if (!this.fs.chmod) return this.reply(402, 'Not supported by file system'); const [mode, ...fileNameParts] = command.arg.split(' '); const fileName = fileNameParts.join(' '); return Promise.resolve().then(() => this.fs.chmod(fileName, parseInt(mode, 8))) .then(() => { return this.reply(200); }) .catch((err) => { log.error(err); return this.reply(500); }); };