@icetee/ftp
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -376,2 +376,13 @@ const fs = require('fs'); | ||
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) { | ||
@@ -378,0 +389,0 @@ this._send('SITE ' + cmd, cb); |
const XRegExp = require('xregexp'); | ||
const REX_LISTUNIX = XRegExp(` | ||
^(?<type>[\\-ld]) | ||
(?<permission>([\\-r][\\-w][\\-xstT]){3}) | ||
^(?<type>[bcdelfmpSs-]) | ||
(?<permission>((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))) | ||
(?<acl>(\\+))?\\s+ | ||
(?<inodes>\\d+)\\s+ | ||
(?<owner>\\d+|\\w+\\s+\\w+|\\w+|\\S+)\\s+ | ||
(?<group>\\d+|\\w+\\s+\\w+|\\w+|\\S+)\\s+ | ||
(?<size>\\d+)\\s+ | ||
(?<owner>\\d+|[A-Z]{1}\\w+\\s+[A-Z]{1}\\w+|\\w+|\\S+)\\s+ | ||
(?<group>\\d+|[A-Z]{1}\\w+\\s+[A-Z]{1}\\w+|\\w+|\\S+)\\s+ | ||
(?<size>\\d+(?:,\\s*\\d*)?)\\s+ | ||
(?<timestamp>((?<month1>\\w{3})\\s+ | ||
@@ -12,0 +12,0 @@ (?<date1>\\d{1,2})\\s+ |
@@ -111,3 +111,4 @@ /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */ | ||
group: retUnix.group, | ||
size: parseInt(retUnix.size, 10), | ||
size: (retUnix.size && retUnix.size.indexOf(',') === -1) ? parseInt(retUnix.size, 10) : 0, | ||
pointer: (retUnix.size && retUnix.size.indexOf(',') > -1) ? retUnix.size.replace(/\s+/g, '') : undefined, | ||
date: undefined, | ||
@@ -114,0 +115,0 @@ }; |
{ | ||
"name": "@icetee/ftp", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": "Tamás András Horváth <htomy92@gmail.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -198,1 +198,5 @@ Description | ||
* **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. |
@@ -0,1 +1,3 @@ | ||
const cYear = (new Date()).getFullYear(); | ||
const entires = [ | ||
@@ -18,2 +20,3 @@ { | ||
size: 4096, | ||
pointer: undefined, | ||
date: new Date('2012-12-21T00:00:00.000Z'), | ||
@@ -39,2 +42,3 @@ }, | ||
size: 0, | ||
pointer: undefined, | ||
date: new Date('2012-08-31T00:00:00.000Z'), | ||
@@ -60,2 +64,3 @@ }, | ||
size: 7045120, | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
@@ -81,2 +86,3 @@ }, | ||
size: 7045120, | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
@@ -102,2 +108,3 @@ }, | ||
size: 7045120, | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
@@ -123,3 +130,4 @@ }, | ||
size: 3065, | ||
date: new Date('2018-05-04T09:01:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
}, | ||
@@ -144,3 +152,4 @@ what: 'File with space in group name', | ||
size: 3065, | ||
date: new Date('2018-05-04T09:01:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
}, | ||
@@ -165,3 +174,4 @@ what: 'File with double space in group name', | ||
size: 3065, | ||
date: new Date('2018-05-04T09:01:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
}, | ||
@@ -186,3 +196,4 @@ what: 'File with space in owner name', | ||
size: 3065, | ||
date: new Date('2018-05-04T09:01:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
}, | ||
@@ -207,3 +218,4 @@ what: 'File with double space in owner name', | ||
size: 3065, | ||
date: new Date('2018-05-04T09:01:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
}, | ||
@@ -228,3 +240,4 @@ what: 'File with space in owner name and group name', | ||
size: 14, | ||
date: new Date('2018-05-14T23:52:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-14T23:52:00.000Z`), | ||
}, | ||
@@ -249,3 +262,4 @@ what: 'File with number owner and hyphen groupname', | ||
size: 14, | ||
date: new Date('2018-05-14T23:52:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-14T23:52:00.000Z`), | ||
}, | ||
@@ -270,2 +284,3 @@ what: 'File with hyphen owner and number groupname', | ||
size: 7045120, | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
@@ -291,2 +306,3 @@ }, | ||
size: 4096, | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
@@ -312,2 +328,3 @@ }, | ||
size: 4096, | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
@@ -333,2 +350,3 @@ }, | ||
size: 4096, | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
@@ -354,2 +372,3 @@ }, | ||
size: 4096, | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
@@ -375,3 +394,4 @@ }, | ||
size: 208, | ||
date: new Date('2018-05-05T09:28:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-05T09:28:00.000Z`), | ||
}, | ||
@@ -396,3 +416,4 @@ what: 'Directory with space in group name', | ||
size: 208, | ||
date: new Date('2018-05-05T09:28:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-05T09:28:00.000Z`), | ||
}, | ||
@@ -417,6 +438,238 @@ what: 'Directory with double space in group name', | ||
size: 208, | ||
date: new Date('2018-05-05T09:28:00.000Z'), | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-05T09:28:00.000Z`), | ||
}, | ||
what: 'Directory with space in group name and owner name', | ||
}, | ||
{ | ||
source: 'drwxr-S--- 3 105207 501 18 Jul 04 2017 .pki', | ||
expected: { | ||
type: 'd', | ||
name: '.pki', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rS', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: '105207', | ||
group: '501', | ||
size: 18, | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
}, | ||
what: 'Directory with undefined bit-state', | ||
}, | ||
{ | ||
source: 'drwxr-s--- 3 105207 501 18 Jul 04 2017 .pki', | ||
expected: { | ||
type: 'd', | ||
name: '.pki', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rs', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: '105207', | ||
group: '501', | ||
size: 18, | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
}, | ||
what: 'Directory with set the set-user-ID or set-group-ID bit', | ||
}, | ||
{ | ||
source: 'drwx--L--- 3 105207 501 18 Jul 04 2017 .pki', | ||
expected: { | ||
type: 'd', | ||
name: '.pki', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'L', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: '105207', | ||
group: '501', | ||
size: 18, | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
}, | ||
what: 'Directory with mandatory lock', | ||
}, | ||
{ | ||
source: 'brwx-w---- 3 105207 501 18 Jul 04 2017 .pki', | ||
expected: { | ||
type: 'b', | ||
name: '.pki', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'w', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: '105207', | ||
group: '501', | ||
size: 18, | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
}, | ||
what: 'Directory with block device simple', | ||
}, | ||
{ | ||
source: 'brw-rw---- 1 root disk 8, 0 Nov 24 10:13 sda', | ||
expected: { | ||
type: 'b', | ||
name: 'sda', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rw', | ||
group: 'rw', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: 'root', | ||
group: 'disk', | ||
size: 0, | ||
pointer: '8,0', | ||
date: new Date('2017-11-24T09:13:00.000Z'), | ||
}, | ||
what: 'Directory with block device', | ||
}, | ||
{ | ||
source: 'crw-rw---- 1 root tty 0 Apr 1 20:30 vcs', | ||
expected: { | ||
type: 'c', | ||
name: 'vcs', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rw', | ||
group: 'rw', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: 'root', | ||
group: 'tty', | ||
size: 0, | ||
pointer: undefined, | ||
date: new Date(`${cYear}-04-01T18:30:00.000Z`), | ||
}, | ||
what: 'Directory with character device without pointer', | ||
}, | ||
{ | ||
source: 'crw-rw---- 1 root tty 7, 134 Apr 1 20:30 vcsa6', | ||
expected: { | ||
type: 'c', | ||
name: 'vcsa6', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rw', | ||
group: 'rw', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: 'root', | ||
group: 'tty', | ||
size: 0, | ||
pointer: '7,134', | ||
date: new Date(`${cYear}-04-01T18:30:00.000Z`), | ||
}, | ||
what: 'Directory with character device with pointer', | ||
}, | ||
{ | ||
source: 'crw-rw---- 1 root tty 7, 0 Apr 1 20:30 vcs', | ||
expected: { | ||
type: 'c', | ||
name: 'vcs', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rw', | ||
group: 'rw', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: 'root', | ||
group: 'tty', | ||
size: 0, | ||
pointer: '7,0', | ||
date: new Date(`${cYear}-04-01T18:30:00.000Z`), | ||
}, | ||
what: 'Directory with character device', | ||
}, | ||
{ | ||
source: 'prwx-w---- 3 105207 501 18 Jul 04 2017 .pki', | ||
expected: { | ||
type: 'p', | ||
name: '.pki', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'w', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: '105207', | ||
group: '501', | ||
size: 18, | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
}, | ||
what: 'Directory with named pipe', | ||
}, | ||
{ | ||
source: 'srwx-w---- 3 105207 501 18 Jul 04 2017 .pki', | ||
expected: { | ||
type: 's', | ||
name: '.pki', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'w', | ||
other: '', | ||
}, | ||
acl: false, | ||
owner: '105207', | ||
group: '501', | ||
size: 18, | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
}, | ||
what: 'Directory with socket', | ||
}, | ||
{ | ||
source: 'lrwxrwxrwx 1 root root 51 Apr 4 23:57 www.nodeftp.github -> /etc/nginx/sites-available/www.nodeftp.github', | ||
expected: { | ||
type: 'l', | ||
name: 'www.nodeftp.github', | ||
target: '/etc/nginx/sites-available/www.nodeftp.github', | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rwx', | ||
other: 'rwx', | ||
}, | ||
acl: false, | ||
owner: 'root', | ||
group: 'root', | ||
size: 51, | ||
pointer: undefined, | ||
date: new Date(`${cYear}-04-04T21:57:00.000Z`), | ||
}, | ||
what: 'Directory with symlink', | ||
}, | ||
// { | ||
@@ -423,0 +676,0 @@ // source: 'drwxr-xr-x 2 oinstall 4096 Jul 25 14:33 log', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76135
2063
202