/usr/local/lib/node_modules/pm2/node_modules/get-uri/dist
NameSizeModeActions
data.d.ts4280644editdlrm
data.js16430644editdlrm
data.js.map11050644editdlrm
file.d.ts5550644editdlrm
file.js20740644editdlrm
file.js.map14110644editdlrm
ftp.d.ts4100644editdlrm
ftp.js31900644editdlrm
ftp.js.map23220644editdlrm
http-error.d.ts2360644editdlrm
http-error.js5060644editdlrm
http-error.js.map4200644editdlrm
http.d.ts8720644editdlrm
http.js72450644editdlrm
http.js.map51870644editdlrm
https.d.ts1950644editdlrm
https.js5440644editdlrm
https.js.map3180644editdlrm
index.d.ts17390644editdlrm
index.js21440644editdlrm
index.js.map11540644editdlrm
notfound.d.ts2800644editdlrm
notfound.js4990644editdlrm
notfound.js.map2620644editdlrm
notmodified.d.ts2640644editdlrm
notmodified.js5380644editdlrm
notmodified.js.map2700644editdlrm
Edit: /usr/local/lib/node_modules/pm2/node_modules/get-uri/dist/ftp.js (3190B)
"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