$26 GRAYBYTE WORDPRESS FILE MANAGER $61

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib/config/

HOME
Current File : /opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib/config//find-prefix.js
// try to find the most reasonable prefix to use

module.exports = findPrefix

var fs = require('fs')
var path = require('path')

function findPrefix (p, cb_) {
  function cb (er, p) {
    process.nextTick(function () {
      cb_(er, p)
    })
  }

  p = path.resolve(p)
  // if there's no node_modules folder, then
  // walk up until we hopefully find one.
  // if none anywhere, then use cwd.
  var walkedUp = false
  while (path.basename(p) === 'node_modules') {
    p = path.dirname(p)
    walkedUp = true
  }
  if (walkedUp) return cb(null, p)

  findPrefix_(p, p, cb)
}

function findPrefix_ (p, original, cb) {
  if (p === '/' ||
      (process.platform === 'win32' && p.match(/^[a-zA-Z]:(\\|\/)?$/))) {
    return cb(null, original)
  }
  fs.readdir(p, function (er, files) {
    // an error right away is a bad sign.
    // unless the prefix was simply a non
    // existent directory.
    if (er && p === original) {
      if (er.code === 'ENOENT') return cb(null, original)
      return cb(er)
    }

    // walked up too high or something.
    if (er) return cb(null, original)

    if (files.indexOf('node_modules') !== -1 ||
        files.indexOf('package.json') !== -1) {
      return cb(null, p)
    }

    var d = path.dirname(p)
    if (d === p) return cb(null, original)

    return findPrefix_(d, original, cb)
  })
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.41 PM
root / root
0755
clear-credentials-by-uri.js
0.413 KB
28 Sep 2021 9.36 AM
root / root
0644
cmd-list.js
1.829 KB
28 Sep 2021 9.36 AM
root / root
0644
core.js
11.031 KB
28 Sep 2021 9.36 AM
root / root
0644
defaults.js
9.981 KB
28 Sep 2021 9.36 AM
root / root
0644
find-prefix.js
1.307 KB
28 Sep 2021 9.36 AM
root / root
0644
get-credentials-by-uri.js
2.06 KB
28 Sep 2021 9.36 AM
root / root
0644
load-cafile.js
0.666 KB
28 Sep 2021 9.36 AM
root / root
0644
load-prefix.js
1.302 KB
28 Sep 2021 9.36 AM
root / root
0644
load-uid.js
0.377 KB
28 Sep 2021 9.36 AM
root / root
0644
nerf-dart.js
0.46 KB
28 Sep 2021 9.36 AM
root / root
0644
set-credentials-by-uri.js
1.236 KB
28 Sep 2021 9.36 AM
root / root
0644
set-user.js
0.731 KB
28 Sep 2021 9.36 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF