SILENT KILLERPanel

Current Path: > > usr > lib > node_modules > npm > > node_modules > tar > lib >


Operation   : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Software     : Apache
Server IP    : 198.54.126.42 | Your IP: 216.73.216.38
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //usr/lib/node_modules/npm//node_modules/tar/lib/

NameTypeSizeLast ModifiedActions
buffer.js File 283 bytes March 10 2021 14:36:37.
create.js File 2374 bytes March 10 2021 14:36:37.
extract.js File 2824 bytes March 10 2021 14:36:37.
header.js File 9044 bytes March 10 2021 14:36:37.
high-level-opt.js File 772 bytes March 10 2021 14:36:37.
large-numbers.js File 2210 bytes March 10 2021 14:36:37.
list.js File 3152 bytes March 10 2021 14:36:37.
mkdir.js File 5178 bytes March 10 2021 14:36:37.
mode-fix.js File 277 bytes March 10 2021 14:36:37.
pack.js File 9614 bytes March 10 2021 14:36:37.
parse.js File 12140 bytes March 10 2021 14:36:37.
pax.js File 4070 bytes March 10 2021 14:36:37.
read-entry.js File 2673 bytes March 10 2021 14:36:37.
replace.js File 5492 bytes March 10 2021 14:36:37.
types.js File 1095 bytes March 10 2021 14:36:37.
unpack.js File 16856 bytes March 10 2021 14:36:37.
update.js File 852 bytes March 10 2021 14:36:37.
warn-mixin.js File 309 bytes March 10 2021 14:36:37.
winchars.js File 533 bytes March 10 2021 14:36:37.
write-entry.js File 12053 bytes March 10 2021 14:36:37.

Reading File: //usr/lib/node_modules/npm//node_modules/tar/lib//large-numbers.js

'use strict'
// Tar can encode large and negative numbers using a leading byte of
// 0xff for negative, and 0x80 for positive.

const encode = exports.encode = (num, buf) => {
  if (!Number.isSafeInteger(num))
    // The number is so large that javascript cannot represent it with integer
    // precision.
    throw TypeError('cannot encode number outside of javascript safe integer range')
  else if (num < 0)
    encodeNegative(num, buf)
  else
    encodePositive(num, buf)
  return buf
}

const encodePositive = (num, buf) => {
  buf[0] = 0x80

  for (var i = buf.length; i > 1; i--) {
    buf[i-1] = num & 0xff
    num = Math.floor(num / 0x100)
  }
}

const encodeNegative = (num, buf) => {
  buf[0] = 0xff
  var flipped = false
  num = num * -1
  for (var i = buf.length; i > 1; i--) {
    var byte = num & 0xff
    num = Math.floor(num / 0x100)
    if (flipped)
      buf[i-1] = onesComp(byte)
    else if (byte === 0)
      buf[i-1] = 0
    else {
      flipped = true
      buf[i-1] = twosComp(byte)
    }
  }
}

const parse = exports.parse = (buf) => {
  var post = buf[buf.length - 1]
  var pre = buf[0]
  var value;
  if (pre === 0x80)
    value = pos(buf.slice(1, buf.length))
  else if (pre === 0xff)
    value = twos(buf)
  else
    throw TypeError('invalid base256 encoding')

  if (!Number.isSafeInteger(value))
    // The number is so large that javascript cannot represent it with integer
    // precision.
    throw TypeError('parsed number outside of javascript safe integer range')

  return value
}

const twos = (buf) => {
  var len = buf.length
  var sum = 0
  var flipped = false
  for (var i = len - 1; i > -1; i--) {
    var byte = buf[i]
    var f
    if (flipped)
      f = onesComp(byte)
    else if (byte === 0)
      f = byte
    else {
      flipped = true
      f = twosComp(byte)
    }
    if (f !== 0)
      sum -= f * Math.pow(256, len - i - 1)
  }
  return sum
}

const pos = (buf) => {
  var len = buf.length
  var sum = 0
  for (var i = len - 1; i > -1; i--) {
    var byte = buf[i]
    if (byte !== 0)
      sum += byte * Math.pow(256, len - i - 1)
  }
  return sum
}

const onesComp = byte => (0xff ^ byte) & 0xff

const twosComp = byte => ((0xff ^ byte) + 1) & 0xff

SILENT KILLER Tool