Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.143.4.99
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/root/proc/3/task/3/root/usr/lib/node_modules/pm2/node_modules/get-uri/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/root/proc/3/task/3/root/usr/lib/node_modules/pm2/node_modules/get-uri/dist/ftp.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ftp = void 0;
const basic_ftp_1 = require("basic-ftp");
const stream_1 = require("stream");
const path_1 = require("path");
const debug_1 = __importDefault(require("debug"));
const notfound_1 = __importDefault(require("./notfound"));
const notmodified_1 = __importDefault(require("./notmodified"));
const debug = (0, debug_1.default)('get-uri:ftp');
/**
 * Returns a Readable stream from an "ftp:" URI.
 */
const ftp = async (url, opts = {}) => {
    const { cache } = opts;
    const filepath = decodeURIComponent(url.pathname);
    let lastModified;
    if (!filepath) {
        throw new TypeError('No "pathname"!');
    }
    const client = new basic_ftp_1.Client();
    try {
        const host = url.hostname || url.host || 'localhost';
        const port = parseInt(url.port || '0', 10) || 21;
        const user = url.username
            ? decodeURIComponent(url.username)
            : undefined;
        const password = url.password
            ? decodeURIComponent(url.password)
            : undefined;
        await client.access({
            host,
            port,
            user,
            password,
            ...opts,
        });
        // first we have to figure out the Last Modified date.
        // try the MDTM command first, which is an optional extension command.
        try {
            lastModified = await client.lastMod(filepath);
        }
        catch (err) {
            // handle the "file not found" error code
            if (err.code === 550) {
                throw new notfound_1.default();
            }
        }
        if (!lastModified) {
            // Try to get the last modified date via the LIST command (uses
            // more bandwidth, but is more compatible with older FTP servers
            const list = await client.list((0, path_1.dirname)(filepath));
            // attempt to find the "entry" with a matching "name"
            const name = (0, path_1.basename)(filepath);
            const entry = list.find((e) => e.name === name);
            if (entry) {
                lastModified = entry.modifiedAt;
            }
        }
        if (lastModified) {
            if (isNotModified()) {
                throw new notmodified_1.default();
            }
        }
        else {
            throw new notfound_1.default();
        }
        const stream = new stream_1.PassThrough();
        const rs = stream;
        client.downloadTo(stream, filepath).then((result) => {
            debug(result.message);
            client.close();
        });
        rs.lastModified = lastModified;
        return rs;
    }
    catch (err) {
        client.close();
        throw err;
    }
    // called when `lastModified` is set, and a "cache" stream was provided
    function isNotModified() {
        if (cache?.lastModified && lastModified) {
            return +cache.lastModified === +lastModified;
        }
        return false;
    }
};
exports.ftp = ftp;
//# sourceMappingURL=ftp.js.map

Anon7 - 2022
AnonSec Team