@icetee/ftp
Advanced tools
Comparing version 1.0.3 to 1.0.5
@@ -49,3 +49,3 @@ const fs = require('fs'); | ||
},*/ | ||
bytesNOOP = new Buffer('NOOP\r\n'); | ||
bytesNOOP = Buffer.from('NOOP\r\n'); | ||
@@ -384,4 +384,4 @@ var FTP = module.exports = function() { | ||
('00' + date.getUTCSeconds()).slice(-2); | ||
this._send('MFMT ' + dateStr + ' ' + path, cb); | ||
this._send('MFMT ' + dateStr + ' ' + path, cb); | ||
} | ||
@@ -585,3 +585,3 @@ | ||
// the socket is closed (e.g. the server ran out of space). | ||
var sockerr, started = false, lastreply = false, done = false, | ||
var sockerr, started = false, done = false, | ||
source = sock; | ||
@@ -620,3 +620,5 @@ | ||
function ondone() { | ||
if (done && lastreply) { | ||
if (! done) return; | ||
if (zcomp) { | ||
self._send('MODE S', function() { | ||
@@ -626,2 +628,5 @@ source._emit('end'); | ||
}, true); | ||
} else { | ||
source._emit('end'); | ||
source._emit('close'); | ||
} | ||
@@ -669,3 +674,2 @@ } | ||
} else { | ||
lastreply = true; | ||
ondone(); | ||
@@ -672,0 +676,0 @@ } |
@@ -6,6 +6,6 @@ const XRegExp = require('xregexp'); | ||
(?<permission>((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))) | ||
(?<acl>(\\+))?\\s+ | ||
(?<acl>([\\+|@]))?\\s+ | ||
(?<inodes>\\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+ | ||
(?<group>\\d+|[A-Z]{1}[\\w\\\\]+\\s+[A-Z]{1}\\w+|\\w+|\\S+)\\s+ | ||
(?<size>\\d+(?:,\\s*\\d*)?)\\s+ | ||
@@ -75,3 +75,3 @@ (?<timestamp>((?<month1>\\w{3})\\s+ | ||
const bytesNOOP = new Buffer('NOOP\r\n'); | ||
const bytesNOOP = Buffer.from('NOOP\r\n'); | ||
@@ -78,0 +78,0 @@ module.exports = { |
@@ -204,3 +204,5 @@ /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */ | ||
year += (year < 70) ? 2000 : 1900; | ||
if (year.toString().length < 4) { | ||
year += (year < 70) ? 2000 : 1900; | ||
} | ||
@@ -207,0 +209,0 @@ if (retMsdos.ampm[0].toLowerCase() === 'p' && hour < 12) { |
{ | ||
"name": "@icetee/ftp", | ||
"version": "1.0.3", | ||
"version": "1.0.5", | ||
"author": "Tamás András Horváth <htomy92@gmail.com>", | ||
@@ -27,3 +27,3 @@ "contributors": [ | ||
"type": "git", | ||
"url": "http://github.com/icetee/node-ftp.git" | ||
"url": "https://github.com/icetee/node-ftp.git" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
const cYear = (new Date()).getFullYear(); | ||
const timezoneDiff = date => ((-new Date(date).getTimezoneOffset() / 60) * 3600000); | ||
const resolveDate = (date, isUTC = false) => { | ||
const d = new Date(date); | ||
let currentYear = (new Date()).getFullYear(); | ||
if (d - 0 > new Date() - 0) { | ||
currentYear--; | ||
d.setFullYear(currentYear); | ||
} | ||
if (isUTC) return d; | ||
return new Date(d - timezoneDiff(date)); | ||
}; | ||
const entires = [ | ||
@@ -21,3 +36,3 @@ { | ||
pointer: undefined, | ||
date: new Date('2012-12-21T00:00:00.000Z'), | ||
date: resolveDate('2012-12-21T00:00:00.000Z', true), | ||
}, | ||
@@ -43,3 +58,3 @@ what: 'Normal directory', | ||
pointer: undefined, | ||
date: new Date('2012-08-31T00:00:00.000Z'), | ||
date: resolveDate('2012-08-31T00:00:00.000Z', true), | ||
}, | ||
@@ -65,3 +80,3 @@ what: 'Normal directory #2', | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
date: resolveDate('2012-09-02T00:00:00.000Z', true), | ||
}, | ||
@@ -87,3 +102,3 @@ what: 'Normal file', | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
date: resolveDate('2012-09-02T00:00:00.000Z', true), | ||
}, | ||
@@ -109,3 +124,3 @@ what: 'File with number id owner', | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
date: resolveDate('2012-09-02T00:00:00.000Z', true), | ||
}, | ||
@@ -131,3 +146,3 @@ what: 'File with number id group', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
date: resolveDate(`${cYear}-05-04T11:01:00.000Z`), | ||
}, | ||
@@ -153,3 +168,3 @@ what: 'File with space in group name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
date: resolveDate(`${cYear}-05-04T11:01:00.000Z`), | ||
}, | ||
@@ -175,3 +190,3 @@ what: 'File with double space in group name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
date: resolveDate(`${cYear}-05-04T11:01:00.000Z`), | ||
}, | ||
@@ -197,3 +212,3 @@ what: 'File with space in owner name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
date: resolveDate(`${cYear}-05-04T11:01:00.000Z`), | ||
}, | ||
@@ -219,3 +234,3 @@ what: 'File with double space in owner name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-04T09:01:00.000Z`), | ||
date: resolveDate(`${cYear}-05-04T11:01:00.000Z`), | ||
}, | ||
@@ -241,3 +256,3 @@ what: 'File with space in owner name and group name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-14T23:52:00.000Z`), | ||
date: resolveDate(`${cYear}-05-15T01:52:00.000Z`), | ||
}, | ||
@@ -263,3 +278,3 @@ what: 'File with number owner and hyphen groupname', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-14T23:52:00.000Z`), | ||
date: resolveDate(`${cYear}-05-15T01:52:00.000Z`), | ||
}, | ||
@@ -285,3 +300,3 @@ what: 'File with hyphen owner and number groupname', | ||
pointer: undefined, | ||
date: new Date('2012-09-02T00:00:00.000Z'), | ||
date: resolveDate('2012-09-02T00:00:00.000Z', true), | ||
}, | ||
@@ -307,3 +322,3 @@ what: 'File with ACL set', | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
date: resolveDate('2012-05-19T00:00:00.000Z', true), | ||
}, | ||
@@ -329,3 +344,3 @@ what: 'Directory with sticky bit and executable for others', | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
date: resolveDate('2012-05-19T00:00:00.000Z', true), | ||
}, | ||
@@ -351,3 +366,3 @@ what: 'Directory with sticky bit and executable for others #2', | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
date: resolveDate('2012-05-19T00:00:00.000Z', true), | ||
}, | ||
@@ -373,3 +388,3 @@ what: 'Directory with sticky bit and not executable for others', | ||
pointer: undefined, | ||
date: new Date('2012-05-19T00:00:00.000Z'), | ||
date: resolveDate('2012-05-19T00:00:00.000Z', true), | ||
}, | ||
@@ -395,3 +410,3 @@ what: 'Directory with sticky bit and not executable for others #2', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-05T09:28:00.000Z`), | ||
date: resolveDate(`${cYear}-05-05T11:28:00.000Z`), | ||
}, | ||
@@ -417,3 +432,3 @@ what: 'Directory with space in group name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-05T09:28:00.000Z`), | ||
date: resolveDate(`${cYear}-05-05T11:28:00.000Z`), | ||
}, | ||
@@ -439,3 +454,3 @@ what: 'Directory with double space in group name', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-05-05T09:28:00.000Z`), | ||
date: resolveDate(`${cYear}-05-05T11:28:00.000Z`), | ||
}, | ||
@@ -461,3 +476,3 @@ what: 'Directory with space in group name and owner name', | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
date: resolveDate('2017-07-04T00:00:00.000Z', true), | ||
}, | ||
@@ -483,3 +498,3 @@ what: 'Directory with undefined bit-state', | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
date: resolveDate('2017-07-04T00:00:00.000Z', true), | ||
}, | ||
@@ -505,3 +520,3 @@ what: 'Directory with set the set-user-ID or set-group-ID bit', | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
date: resolveDate('2017-07-04T00:00:00.000Z', true), | ||
}, | ||
@@ -527,3 +542,3 @@ what: 'Directory with mandatory lock', | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
date: resolveDate('2017-07-04T00:00:00.000Z', true), | ||
}, | ||
@@ -549,3 +564,3 @@ what: 'Directory with block device simple', | ||
pointer: '8,0', | ||
date: new Date('2017-11-24T09:13:00.000Z'), | ||
date: resolveDate(`${cYear}-11-24T10:13:00.000Z`), | ||
}, | ||
@@ -571,3 +586,3 @@ what: 'Directory with block device', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-04-01T18:30:00.000Z`), | ||
date: resolveDate(`${cYear}-04-01T20:30:00.000Z`), | ||
}, | ||
@@ -593,3 +608,3 @@ what: 'Directory with character device without pointer', | ||
pointer: '7,134', | ||
date: new Date(`${cYear}-04-01T18:30:00.000Z`), | ||
date: resolveDate(`${cYear}-04-01T20:30:00.000Z`), | ||
}, | ||
@@ -615,3 +630,3 @@ what: 'Directory with character device with pointer', | ||
pointer: '7,0', | ||
date: new Date(`${cYear}-04-01T18:30:00.000Z`), | ||
date: resolveDate(`${cYear}-04-01T20:30:00.000Z`), | ||
}, | ||
@@ -637,3 +652,3 @@ what: 'Directory with character device', | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
date: resolveDate('2017-07-04T00:00:00.000Z', true), | ||
}, | ||
@@ -659,3 +674,3 @@ what: 'Directory with named pipe', | ||
pointer: undefined, | ||
date: new Date('2017-07-04T00:00:00.000Z'), | ||
date: resolveDate('2017-07-04T00:00:00.000Z', true), | ||
}, | ||
@@ -681,3 +696,3 @@ what: 'Directory with socket', | ||
pointer: undefined, | ||
date: new Date(`${cYear}-04-04T21:57:00.000Z`), | ||
date: resolveDate(`${cYear}-04-04T23:57:00.000Z`), | ||
}, | ||
@@ -702,3 +717,3 @@ what: 'Directory with symlink', | ||
// size: 4096, | ||
// date: new Date('2012-12-21T00:00:00.000Z'), | ||
// date: resolveDate('2012-12-21T00:00:00.000Z', true), | ||
// }, | ||
@@ -708,2 +723,228 @@ // what: 'Directory without group', | ||
{ | ||
source: '-rw-rw-rw-@ 1 owner group 7045120 Sep 02 2012 music.mp3', | ||
expected: { | ||
type: '-', | ||
name: 'music.mp3', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rw', | ||
group: 'rw', | ||
other: 'rw', | ||
}, | ||
acl: false, | ||
owner: 'owner', | ||
group: 'group', | ||
size: 7045120, | ||
pointer: undefined, | ||
date: resolveDate('2012-09-02T00:00:00.000Z', true), | ||
}, | ||
what: 'MacOS @ symbol file', | ||
}, | ||
{ | ||
source: 'drwxr-xr-x 10 root root 4096 Dec 21 2012 1.1 Header [13]', | ||
expected: { | ||
type: 'd', | ||
name: '1.1 Header [13]', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rx', | ||
other: 'rx', | ||
}, | ||
acl: false, | ||
owner: 'root', | ||
group: 'root', | ||
size: 4096, | ||
pointer: undefined, | ||
date: resolveDate('2012-12-21T00:00:00.000Z', true), | ||
}, | ||
what: 'Directory with special name #2', | ||
}, | ||
{ | ||
source: '08-22-18 02:05PM <DIR> Test', | ||
expected: { | ||
type: 'd', | ||
name: 'Test', | ||
size: 0, | ||
date: resolveDate('2018-08-22T14:05:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory #1', | ||
}, | ||
{ | ||
source: '08-22-18 02:05PM <DIR> Name []', | ||
expected: { | ||
type: 'd', | ||
name: 'Name []', | ||
size: 0, | ||
date: resolveDate('2018-08-22T14:05:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory #2', | ||
}, | ||
{ | ||
source: '08-22-18 02:05PM <DIR> 12', | ||
expected: { | ||
type: 'd', | ||
name: '12', | ||
size: 0, | ||
date: resolveDate('2018-08-22T14:05:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory with 2 digit character in filename', | ||
}, | ||
{ | ||
source: '08-22-18 02:05PM <DIR> 2015', | ||
expected: { | ||
type: 'd', | ||
name: '2015', | ||
size: 0, | ||
date: resolveDate('2018-08-22T14:05:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory with 4 digit character in filename', | ||
}, | ||
{ | ||
source: '08-22-18 02:05PM <DIR> 1.1 Header [13]', | ||
expected: { | ||
type: 'd', | ||
name: '1.1 Header [13]', | ||
size: 0, | ||
date: resolveDate('2018-08-22T14:05:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory #3', | ||
}, | ||
{ | ||
source: '08-22-2018 02:05PM <DIR> wwwroot', | ||
expected: { | ||
type: 'd', | ||
name: 'wwwroot', | ||
size: 0, | ||
date: resolveDate('2018-08-22T14:05:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory with 4 four-digit years', | ||
}, | ||
{ | ||
source: '07-10-13 06:54AM <DIR> 1400', | ||
expected: { | ||
type: 'd', | ||
name: '1400', | ||
size: 0, | ||
date: resolveDate('2013-07-10T06:54:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal directory without tab', | ||
}, | ||
{ | ||
source: '08-22-18 12:59PM 99710 iisstart.png', | ||
expected: { | ||
type: '-', | ||
name: 'iisstart.png', | ||
size: 99710, | ||
date: resolveDate('2018-08-22T12:59:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal file #1', | ||
}, | ||
{ | ||
source: '08-22-18 12:59PM 990 2015', | ||
expected: { | ||
type: '-', | ||
name: '2015', | ||
size: 990, | ||
date: resolveDate('2018-08-22T12:59:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal file #2', | ||
}, | ||
{ | ||
source: '08-22-18 12:59PM 2015 2015', | ||
expected: { | ||
type: '-', | ||
name: '2015', | ||
size: 2015, | ||
date: resolveDate('2018-08-22T12:59:00.000Z'), | ||
}, | ||
what: 'MSDOS Normal file #3', | ||
}, | ||
{ | ||
source: 'drwxrwxrwx 1 owner group 0 Aug 22 14:05 wwwroot', | ||
expected: { | ||
type: 'd', | ||
name: 'wwwroot', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rwx', | ||
other: 'rwx', | ||
}, | ||
acl: false, | ||
owner: 'owner', | ||
group: 'group', | ||
size: 0, | ||
pointer: undefined, | ||
date: resolveDate(`${cYear}-08-22T14:05:00.000Z`), | ||
}, | ||
what: 'Windows with UNIX style directory #1', | ||
}, | ||
{ | ||
source: 'drwxrwxrwx 1 owner group 0 Aug 22 14:05 Name []', | ||
expected: { | ||
type: 'd', | ||
name: 'Name []', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rwx', | ||
other: 'rwx', | ||
}, | ||
acl: false, | ||
owner: 'owner', | ||
group: 'group', | ||
size: 0, | ||
pointer: undefined, | ||
date: resolveDate(`${cYear}-08-22T14:05:00.000Z`), | ||
}, | ||
what: 'Windows with UNIX style directory #2', | ||
}, | ||
{ | ||
source: '-rwxrwxrwx 1 owner group 99710 Aug 22 12:59 iisstart.png', | ||
expected: { | ||
type: '-', | ||
name: 'iisstart.png', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rwx', | ||
group: 'rwx', | ||
other: 'rwx', | ||
}, | ||
acl: false, | ||
owner: 'owner', | ||
group: 'group', | ||
size: 99710, | ||
pointer: undefined, | ||
date: resolveDate(`${cYear}-08-22T12:59:00.000Z`), | ||
}, | ||
what: 'Windows with UNIX style file #1', | ||
}, | ||
{ | ||
source: '-rw-r--r-- 1 300794 AD\\Domain Users 6148 Sep 19 06:17 .DS_Store', | ||
expected: { | ||
type: '-', | ||
name: '.DS_Store', | ||
target: undefined, | ||
sticky: false, | ||
rights: { | ||
user: 'rw', | ||
group: 'r', | ||
other: 'r', | ||
}, | ||
acl: false, | ||
owner: '300794', | ||
group: 'AD\\Domain Users', | ||
size: 6148, | ||
pointer: undefined, | ||
date: resolveDate(`${cYear}-09-19T06:17:00.000Z`), | ||
}, | ||
what: 'Windows Active Directory double slash in groupname', | ||
}, | ||
{ | ||
source: 'total 871', | ||
@@ -710,0 +951,0 @@ expected: null, |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
82927
2323
8