Skip to content

Commit

Permalink
Supported setLastMod command
Browse files Browse the repository at this point in the history
  • Loading branch information
icetee committed Jun 16, 2018
1 parent d096e0c commit b2ba80e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 11 additions & 0 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit b2ba80e

Please sign in to comment.