403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.144.97.216
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/usr/lib/node_modules/npm/node_modules/pacote/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/usr/lib/node_modules/npm/node_modules/pacote/prefetch.js
'use strict'

const BB = require('bluebird')

const cacache = require('cacache')
const finished = BB.promisify(require('mississippi').finished)
const optCheck = require('./lib/util/opt-check')
const npa = require('npm-package-arg')

module.exports = prefetch
function prefetch (spec, opts) {
  opts = optCheck(opts)
  spec = npa(spec, opts.where)
  opts.log.warn('prefetch', 'pacote.prefetch() is deprecated. Please use pacote.tarball() instead.')
  const startTime = Date.now()
  if (!opts.cache) {
    opts.log.info('prefetch', 'skipping prefetch: no cache provided')
    return BB.resolve({ spec })
  }
  if (opts.integrity && !opts.preferOnline) {
    opts.log.silly('prefetch', 'checking if', opts.integrity, 'is already cached')
    return cacache.get.hasContent(opts.cache, opts.integrity).then(info => {
      if (info) {
        opts.log.silly('prefetch', `content already exists for ${spec} (${Date.now() - startTime}ms)`)
        return {
          spec,
          integrity: info.integrity,
          size: info.size,
          byDigest: true
        }
      } else {
        return prefetchByManifest(startTime, spec, opts)
      }
    })
  } else {
    opts.log.silly('prefetch', `no integrity hash provided for ${spec} - fetching by manifest`)
    return prefetchByManifest(startTime, spec, opts)
  }
}

let fetch
function prefetchByManifest (start, spec, opts) {
  let manifest
  let integrity
  return BB.resolve().then(() => {
    if (!fetch) {
      fetch = require('./lib/fetch')
    }
    const stream = fetch.tarball(spec, opts)
    if (!stream) { return }
    stream.on('data', function () {})
    stream.on('manifest', m => { manifest = m })
    stream.on('integrity', i => { integrity = i })
    return finished(stream)
  }).then(() => {
    opts.log.silly('prefetch', `${spec} done in ${Date.now() - start}ms`)
    return {
      manifest,
      spec,
      integrity: integrity || (manifest && manifest._integrity),
      byDigest: false
    }
  })
}

Youez - 2016 - github.com/yon3zu
LinuXploit