diff --git a/README.md b/README.md index d8d542f..9bce88c 100644 --- a/README.md +++ b/README.md @@ -195,3 +195,7 @@ Methods * **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. * **mlsd**([< _string_ >path, ][< _boolean_ >useCompression, ]< _function_ >callback) - _(void)_ - Retrieves the directory listing of `path`. `path` defaults to the current working directory. `useCompression` defaults to false. `callback` has 2 parameters: < _Error_ >err, < _array_ >list. See the `list` command for a list of properties. Also see https://tools.ietf.org/html/rfc3659 7.2. + +### 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. diff --git a/lib/connection.js b/lib/connection.js index 0f58d55..ff70788 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -373,6 +373,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); };