diff --git a/README.md b/README.md index 922fd52..0d307b0 100644 --- a/README.md +++ b/README.md @@ -193,3 +193,7 @@ Methods * **lastMod**(< _string_ >path, < _function_ >callback) - _(void)_ - Retrieves the last modified date and time for `path`. `callback` has 2 parameters: < _Error_ >err, < _Date_ >lastModified. * **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. + +### Draft commands (draft-somers-ftp-mfxx-04) + +* **setLastMod**(< _string_ >path, < _Date_ >date, < _function_ >callback) - _(void)_ - Set modification time for `path`. `callback` has 1 parameter: < _Error_ >err. \ No newline at end of file diff --git a/lib/connection.js b/lib/connection.js index 606de14..7093da8 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -357,6 +357,17 @@ FTP.prototype.delete = function(path, cb) { this._send('DELE ' + path, cb); }; +FTP.prototype.setLastMod = function(path, date, cb) { + var dateStr = + date.getUTCFullYear() + + ('00' + (date.getUTCMonth() + 1)).slice(-2) + + ('00' + date.getUTCDate()).slice(-2) + + ('00' + date.getUTCHours()).slice(-2) + + ('00' + date.getUTCMinutes()).slice(-2) + + ('00' + date.getUTCSeconds()).slice(-2); + this._send('MFMT ' + dateStr + ' ' + path, cb); +} + FTP.prototype.site = function(cmd, cb) { this._send('SITE ' + cmd, cb); };