$37 GRAYBYTE WORDPRESS FILE MANAGER $98

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/node_modules/npm/node_modules/pacote/lib/

HOME
Current File : /usr/lib/node_modules/npm/node_modules/pacote/lib//extract-stream.js
'use strict'

const Minipass = require('minipass')
const path = require('path')
const tar = require('tar')

module.exports = extractStream
module.exports._computeMode = computeMode

class Transformer extends Minipass {
  constructor (spec, opts) {
    super()
    this.spec = spec
    this.opts = opts
    this.str = ''
  }
  write (data) {
    this.str += data
    return true
  }
  end () {
    const replaced = this.str.replace(
      /}\s*$/,
      `\n,"_resolved": ${
        JSON.stringify(this.opts.resolved || '')
      }\n,"_integrity": ${
        JSON.stringify(this.opts.integrity || '')
      }\n,"_from": ${
        JSON.stringify(this.spec.toString())
      }\n}`
    )
    super.write(replaced)
    return super.end()
  }
}

function computeMode (fileMode, optMode, umask) {
  return (fileMode | optMode) & ~(umask || 0)
}

function pkgJsonTransform (spec, opts) {
  return entry => {
    if (entry.path === 'package.json') {
      const transformed = new Transformer(spec, opts)
      return transformed
    }
  }
}

function extractStream (spec, dest, opts) {
  opts = opts || {}
  const sawIgnores = new Set()
  return tar.x({
    cwd: dest,
    filter: (name, entry) => !entry.header.type.match(/^.*link$/i),
    strip: 1,
    onwarn: msg => opts.log && opts.log.warn('tar', msg),
    uid: opts.uid,
    gid: opts.gid,
    umask: opts.umask,
    transform: opts.resolved && pkgJsonTransform(spec, opts),
    onentry (entry) {
      if (entry.type.toLowerCase() === 'file') {
        entry.mode = computeMode(entry.mode, opts.fmode, opts.umask)
      } else if (entry.type.toLowerCase() === 'directory') {
        entry.mode = computeMode(entry.mode, opts.dmode, opts.umask)
      } else {
        entry.mode = computeMode(entry.mode, 0, opts.umask)
      }

      // Note: This mirrors logic in the fs read operations that are
      // employed during tarball creation, in the fstream-npm module.
      // It is duplicated here to handle tarballs that are created
      // using other means, such as system tar or git archive.
      if (entry.type.toLowerCase() === 'file') {
        const base = path.basename(entry.path)
        if (base === '.npmignore') {
          sawIgnores.add(entry.path)
        } else if (base === '.gitignore') {
          const npmignore = entry.path.replace(/\.gitignore$/, '.npmignore')
          if (!sawIgnores.has(npmignore)) {
            // Rename, may be clobbered later.
            entry.path = npmignore
          }
        }
      }
    }
  })
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Jan 1970 8.00 AM
root / root
0
fetchers
--
31 Aug 2024 8.02 AM
root / root
0755
util
--
31 Aug 2024 8.02 AM
root / root
0755
extract-stream.js
2.447 KB
10 Mar 2021 9.36 PM
root / root
0644
fetch.js
2.119 KB
10 Mar 2021 9.36 PM
root / root
0644
finalize-manifest.js
8.335 KB
10 Mar 2021 9.36 PM
root / root
0644
with-tarball-stream.js
4.731 KB
10 Mar 2021 9.36 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF