forked from QuorumDMS/ftp-srv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstou.js
More file actions
21 lines (19 loc) · 679 Bytes
/
stou.js
File metadata and controls
21 lines (19 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Bluebird removed
const {handler: stor} = require('./stor');
module.exports = {
directive: 'STOU',
handler: function (args) {
if (!this.fs) return this.reply(550, 'File system not instantiated');
if (!this.fs.get || !this.fs.getUniqueName) return this.reply(402, 'Not supported by file system');
const fileName = args.command.arg;
return Promise.resolve().then(() => this.fs.get(fileName))
.then(() => Promise.resolve().then(() => this.fs.getUniqueName(fileName)))
.catch(() => fileName)
.then((name) => {
args.command.arg = name;
return stor.call(this, args);
});
},
syntax: '{{cmd}}',
description: 'Store file uniquely'
};