Skip to content

Commit 273ca30

Browse files
committed
Implemented setLastMod() (MFMT command)
1 parent 7dff82f commit 273ca30

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,7 @@ Methods
193193
* **lastMod**(< _string_ >path, < _function_ >callback) - _(void)_ - Retrieves the last modified date and time for `path`. `callback` has 2 parameters: < _Error_ >err, < _Date_ >lastModified.
194194

195195
* **restart**(< _integer_ >byteOffset, < _function_ >callback) - _(void)_ - Sets the file byte offset for the next file transfer action (get/put) to `byteOffset`. `callback` has 1 parameter: < _Error_ >err.
196+
197+
### Draft commands (draft-somers-ftp-mfxx-04)
198+
199+
* **setLastMod**(< _string_ >path, < _Date_ >date, < _function_ >callback) - _(void)_ - Set modification time for `path`. `callback` has 1 parameter: < _Error_ >err.

lib/connection.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,17 @@ FTP.prototype.delete = function(path, cb) {
357357
this._send('DELE ' + path, cb);
358358
};
359359

360+
FTP.prototype.setLastMod = function(path, date, cb) {
361+
var dateStr =
362+
date.getFullYear() +
363+
('00' + (date.getMonth() + 1)).slice(-2) +
364+
('00' + date.getDate()).slice(-2) +
365+
('00' + date.getHours()).slice(-2) +
366+
('00' + date.getMinutes()).slice(-2) +
367+
('00' + date.getSeconds()).slice(-2);
368+
this._send('MFMT ' + dateStr + ' ' + path, cb);
369+
}
370+
360371
FTP.prototype.site = function(cmd, cb) {
361372
this._send('SITE ' + cmd, cb);
362373
};

0 commit comments

Comments
 (0)