✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ premium290.web-hosting.com ​🇻​♯➤ 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 63.250.38.37 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.217.36
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /lib/node_modules/npm/node_modules/pacote/lib//with-tarball-stream.js
'use strict'

const BB = require('bluebird')

const cacache = require('cacache')
const fetch = require('./fetch.js')
const fs = require('fs')
const npa = require('npm-package-arg')
const optCheck = require('./util/opt-check.js')
const path = require('path')
const ssri = require('ssri')
const retry = require('promise-retry')

const statAsync = BB.promisify(fs.stat)

const RETRIABLE_ERRORS = new Set(['ENOENT', 'EINTEGRITY', 'Z_DATA_ERROR'])

module.exports = withTarballStream
function withTarballStream (spec, opts, streamHandler) {
  opts = optCheck(opts)
  spec = npa(spec, opts.where)

  // First, we check for a file: resolved shortcut
  const tryFile = (
    !opts.preferOnline &&
    opts.integrity &&
    opts.resolved &&
    opts.resolved.startsWith('file:')
  )
    ? BB.try(() => {
    // NOTE - this is a special shortcut! Packages installed as files do not
    // have a `resolved` field -- this specific case only occurs when you have,
    // say, a git dependency or a registry dependency that you've packaged into
    // a local file, and put that file: spec in the `resolved` field.
      opts.log.silly('pacote', `trying ${spec} by local file: ${opts.resolved}`)
      const file = path.resolve(opts.where || '.', opts.resolved.substr(5))
      return statAsync(file)
        .then(() => {
          const verifier = ssri.integrityStream({ integrity: opts.integrity })
          const stream = fs.createReadStream(file)
            .on('error', err => verifier.emit('error', err))
            .pipe(verifier)
          return streamHandler(stream)
        })
        .catch(err => {
          if (err.code === 'EINTEGRITY') {
            opts.log.warn('pacote', `EINTEGRITY while extracting ${spec} from ${file}.You will have to recreate the file.`)
            opts.log.verbose('pacote', `EINTEGRITY for ${spec}: ${err.message}`)
          }
          throw err
        })
    })
    : BB.reject(Object.assign(new Error('no file!'), { code: 'ENOENT' }))

  const tryDigest = tryFile
    .catch(err => {
      if (
        opts.preferOnline ||
      !opts.cache ||
      !opts.integrity ||
      !RETRIABLE_ERRORS.has(err.code)
      ) {
        throw err
      } else {
        opts.log.silly('tarball', `trying ${spec} by hash: ${opts.integrity}`)
        const stream = cacache.get.stream.byDigest(
          opts.cache, opts.integrity, opts
        )
        stream.once('error', err => stream.on('newListener', (ev, l) => {
          if (ev === 'error') { l(err) }
        }))
        return streamHandler(stream)
          .catch(err => {
            if (err.code === 'EINTEGRITY' || err.code === 'Z_DATA_ERROR') {
              opts.log.warn('tarball', `cached data for ${spec} (${opts.integrity}) seems to be corrupted. Refreshing cache.`)
              return cleanUpCached(opts.cache, opts.integrity, opts)
                .then(() => { throw err })
            } else {
              throw err
            }
          })
      }
    })

  const trySpec = tryDigest
    .catch(err => {
      if (!RETRIABLE_ERRORS.has(err.code)) {
      // If it's not one of our retriable errors, bail out and give up.
        throw err
      } else {
        opts.log.silly(
          'tarball',
          `no local data for ${spec}. Extracting by manifest.`
        )
        return BB.resolve(retry((tryAgain, attemptNum) => {
          const tardata = fetch.tarball(spec, opts)
          if (!opts.resolved) {
            tardata.on('manifest', m => {
              opts = opts.concat({ resolved: m._resolved })
            })
            tardata.on('integrity', i => {
              opts = opts.concat({ integrity: i })
            })
          }
          return BB.try(() => streamHandler(tardata))
            .catch(err => {
              // Retry once if we have a cache, to clear up any weird conditions.
              // Don't retry network errors, though -- make-fetch-happen has already
              // taken care of making sure we're all set on that front.
              if (opts.cache && err.code && !String(err.code).match(/^E\d{3}$/)) {
                if (err.code === 'EINTEGRITY' || err.code === 'Z_DATA_ERROR') {
                  opts.log.warn('tarball', `tarball data for ${spec} (${opts.integrity}) seems to be corrupted. Trying one more time.`)
                }
                return cleanUpCached(opts.cache, err.sri, opts)
                  .then(() => tryAgain(err))
              } else {
                throw err
              }
            })
        }, { retries: 1 }))
      }
    })

  return trySpec
    .catch(err => {
      if (err.code === 'EINTEGRITY') {
        err.message = `Verification failed while extracting ${spec}:\n${err.message}`
      }
      throw err
    })
}

function cleanUpCached (cachePath, integrity, opts) {
  return cacache.rm.content(cachePath, integrity, opts)
}


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
1 Jan 1970 12.00 AM
root / root
0
fetchers
--
3 Mar 2024 10.36 PM
root / root
0755
util
--
3 Mar 2024 10.36 PM
root / root
0755
extract-stream.js
2.447 KB
10 Mar 2021 2.36 PM
root / root
0644
fetch.js
2.119 KB
10 Mar 2021 2.36 PM
root / root
0644
finalize-manifest.js
8.335 KB
10 Mar 2021 2.36 PM
root / root
0644
with-tarball-stream.js
4.731 KB
10 Mar 2021 2.36 PM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF