$41 GRAYBYTE WORDPRESS FILE MANAGER $65

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

/opt/alt/alt-nodejs16/root/usr/lib/node_modules/npm/lib/utils/

HOME
Current File : /opt/alt/alt-nodejs16/root/usr/lib/node_modules/npm/lib/utils//tar.js
const tar = require('tar')
const ssri = require('ssri')
const log = require('./log-shim')
const formatBytes = require('./format-bytes.js')
const columnify = require('columnify')
const localeCompare = require('@isaacs/string-locale-compare')('en', {
  sensitivity: 'case',
  numeric: true,
})

const logTar = (tarball, opts = {}) => {
  const { unicode = false } = opts
  log.notice('')
  log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`)
  log.notice('=== Tarball Contents ===')
  if (tarball.files.length) {
    log.notice(
      '',
      columnify(
        tarball.files
          .map(f => {
            const bytes = formatBytes(f.size, false)
            return /^node_modules\//.test(f.path) ? null : { path: f.path, size: `${bytes}` }
          })
          .filter(f => f),
        {
          include: ['size', 'path'],
          showHeaders: false,
        }
      )
    )
  }
  if (tarball.bundled.length) {
    log.notice('=== Bundled Dependencies ===')
    tarball.bundled.forEach(name => log.notice('', name))
  }
  log.notice('=== Tarball Details ===')
  log.notice(
    '',
    columnify(
      [
        { name: 'name:', value: tarball.name },
        { name: 'version:', value: tarball.version },
        tarball.filename && { name: 'filename:', value: tarball.filename },
        { name: 'package size:', value: formatBytes(tarball.size) },
        { name: 'unpacked size:', value: formatBytes(tarball.unpackedSize) },
        { name: 'shasum:', value: tarball.shasum },
        {
          name: 'integrity:',
          value:
            tarball.integrity.toString().slice(0, 20) +
            '[...]' +
            tarball.integrity.toString().slice(80),
        },
        tarball.bundled.length && { name: 'bundled deps:', value: tarball.bundled.length },
        tarball.bundled.length && {
          name: 'bundled files:',
          value: tarball.entryCount - tarball.files.length,
        },
        tarball.bundled.length && { name: 'own files:', value: tarball.files.length },
        { name: 'total files:', value: tarball.entryCount },
      ].filter(x => x),
      {
        include: ['name', 'value'],
        showHeaders: false,
      }
    )
  )
  log.notice('', '')
}

const getContents = async (manifest, tarball) => {
  const files = []
  const bundled = new Set()
  let totalEntries = 0
  let totalEntrySize = 0

  // reads contents of tarball
  const stream = tar.t({
    onentry (entry) {
      totalEntries++
      totalEntrySize += entry.size
      const p = entry.path
      if (p.startsWith('package/node_modules/')) {
        const name = p.match(/^package\/node_modules\/((?:@[^/]+\/)?[^/]+)/)[1]
        bundled.add(name)
      }
      files.push({
        path: entry.path.replace(/^package\//, ''),
        size: entry.size,
        mode: entry.mode,
      })
    },
  })
  stream.end(tarball)

  const integrity = await ssri.fromData(tarball, {
    algorithms: ['sha1', 'sha512'],
  })

  const comparator = ({ path: a }, { path: b }) => localeCompare(a, b)

  const isUpper = str => {
    const ch = str.charAt(0)
    return ch === ch.toUpperCase()
  }

  const uppers = files.filter(file => isUpper(file.path))
  const others = files.filter(file => !isUpper(file.path))

  uppers.sort(comparator)
  others.sort(comparator)

  const shasum = integrity.sha1[0].hexDigest()
  return {
    id: manifest._id || `${manifest.name}@${manifest.version}`,
    name: manifest.name,
    version: manifest.version,
    size: tarball.length,
    unpackedSize: totalEntrySize,
    shasum,
    integrity: ssri.parse(integrity.sha512[0]),
    filename: `${manifest.name}-${manifest.version}.tgz`,
    files: uppers.concat(others),
    entryCount: totalEntries,
    bundled: Array.from(bundled),
  }
}

module.exports = { logTar, getContents }

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 8.02 AM
root / root
0755
completion
--
31 Aug 2024 8.02 AM
root / root
0755
config
--
31 Aug 2024 8.02 AM
root / root
0755
ansi-trim.js
0.169 KB
3 Nov 2023 9.14 PM
root / root
0644
audit-error.js
0.955 KB
3 Nov 2023 9.14 PM
root / root
0644
cmd-list.js
2.46 KB
3 Nov 2023 9.14 PM
root / root
0644
completion.sh
1.854 KB
3 Nov 2023 9.14 PM
root / root
0755
did-you-mean.js
1.463 KB
3 Nov 2023 9.14 PM
root / root
0644
display.js
2.84 KB
3 Nov 2023 9.14 PM
root / root
0644
error-message.js
12.642 KB
3 Nov 2023 9.14 PM
root / root
0644
exit-handler.js
6.767 KB
3 Nov 2023 9.14 PM
root / root
0644
explain-dep.js
3.733 KB
3 Nov 2023 9.14 PM
root / root
0644
explain-eresolve.js
2.557 KB
3 Nov 2023 9.14 PM
root / root
0644
format-bytes.js
0.614 KB
3 Nov 2023 9.14 PM
root / root
0644
format-search-stream.js
3.929 KB
3 Nov 2023 9.14 PM
root / root
0644
get-identity.js
0.723 KB
3 Nov 2023 9.14 PM
root / root
0644
is-windows.js
0.228 KB
3 Nov 2023 9.14 PM
root / root
0644
log-file.js
7.644 KB
3 Nov 2023 9.14 PM
root / root
0644
log-shim.js
1.678 KB
3 Nov 2023 9.14 PM
root / root
0644
npm-usage.js
1.952 KB
3 Nov 2023 9.14 PM
root / root
0644
open-url-prompt.js
1.539 KB
3 Nov 2023 9.14 PM
root / root
0644
open-url.js
1.174 KB
3 Nov 2023 9.14 PM
root / root
0644
otplease.js
1.231 KB
3 Nov 2023 9.14 PM
root / root
0644
ping.js
0.246 KB
3 Nov 2023 9.14 PM
root / root
0644
pulse-till-done.js
0.402 KB
3 Nov 2023 9.14 PM
root / root
0644
queryable.js
9.577 KB
3 Nov 2023 9.14 PM
root / root
0644
read-user-info.js
1.989 KB
3 Nov 2023 9.14 PM
root / root
0644
reify-finish.js
0.855 KB
3 Nov 2023 9.14 PM
root / root
0644
reify-output.js
4.962 KB
3 Nov 2023 9.14 PM
root / root
0644
replace-info.js
0.788 KB
3 Nov 2023 9.14 PM
root / root
0644
tar.js
3.729 KB
3 Nov 2023 9.14 PM
root / root
0644
timers.js
3.181 KB
3 Nov 2023 9.14 PM
root / root
0644
update-notifier.js
4.452 KB
3 Nov 2023 9.14 PM
root / root
0644
validate-lockfile.js
0.999 KB
3 Nov 2023 9.14 PM
root / root
0644
web-auth.js
0.545 KB
3 Nov 2023 9.14 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF