| Server IP : 88.99.149.37 / Your IP : 216.73.216.141 Web Server : nginx/1.31.2 System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64 User : muralimurth ( 1015) PHP Version : 8.4.23 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/1/cwd/proc/1/root/lib/node_modules/pm2/node_modules/basic-ftp/dist/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.testLine = testLine;
exports.parseLine = parseLine;
exports.transformList = transformList;
const FileInfo_1 = require("./FileInfo");
/**
* This parser is based on the FTP client library source code in Apache Commons Net provided
* under the Apache 2.0 license. It has been simplified and rewritten to better fit the Javascript language.
*
* https://github.com/apache/commons-net/blob/master/src/main/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java
*/
const RE_LINE = new RegExp("(\\S+)\\s+(\\S+)\\s+" // MM-dd-yy whitespace hh:mma|kk:mm swallow trailing spaces
+ "(?:(<DIR>)|([0-9]+))\\s+" // <DIR> or ddddd swallow trailing spaces
+ "(\\S.*)" // First non-space followed by rest of line (name)
);
/**
* Returns true if a given line might be a DOS-style listing.
*
* - Example: `12-05-96 05:03PM <DIR> myDir`
*/
function testLine(line) {
return /^\d{2}/.test(line) && RE_LINE.test(line);
}
/**
* Parse a single line of a DOS-style directory listing.
*/
function parseLine(line) {
const groups = line.match(RE_LINE);
if (groups === null) {
return undefined;
}
const name = groups[5];
if (name === "." || name === "..") { // Ignore parent directory links
return undefined;
}
const file = new FileInfo_1.FileInfo(name);
const fileType = groups[3];
if (fileType === "<DIR>") {
file.type = FileInfo_1.FileType.Directory;
file.size = 0;
}
else {
file.type = FileInfo_1.FileType.File;
file.size = parseInt(groups[4], 10);
}
file.rawModifiedAt = groups[1] + " " + groups[2];
return file;
}
function transformList(files) {
return files;
}