403Webshell
Server IP : 107.13.46.68  /  Your IP : 216.73.216.232
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/node_modules/minipass-sized/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/node_modules/minipass-sized/index.js
const Minipass = require('minipass')

class SizeError extends Error {
  constructor (found, expect) {
    super(`Bad data size: expected ${expect} bytes, but got ${found}`)
    this.expect = expect
    this.found = found
    this.code = 'EBADSIZE'
	  Error.captureStackTrace(this, this.constructor)
  }
  get name () {
    return 'SizeError'
  }
}

class MinipassSized extends Minipass {
  constructor (options = {}) {
    super(options)

    if (options.objectMode)
      throw new TypeError(`${
        this.constructor.name
      } streams only work with string and buffer data`)

    this.found = 0
    this.expect = options.size
    if (typeof this.expect !== 'number' ||
        this.expect > Number.MAX_SAFE_INTEGER ||
        isNaN(this.expect) ||
        this.expect < 0 ||
        !isFinite(this.expect) ||
        this.expect !== Math.floor(this.expect))
      throw new Error('invalid expected size: ' + this.expect)
  }

  write (chunk, encoding, cb) {
    const buffer = Buffer.isBuffer(chunk) ? chunk
      : typeof chunk === 'string' ?
        Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8')
      : chunk

    if (!Buffer.isBuffer(buffer)) {
      this.emit('error', new TypeError(`${
        this.constructor.name
      } streams only work with string and buffer data`))
      return false
    }

    this.found += buffer.length
    if (this.found > this.expect)
      this.emit('error', new SizeError(this.found, this.expect))

    return super.write(chunk, encoding, cb)
  }

  emit (ev, ...data) {
    if (ev === 'end') {
      if (this.found !== this.expect)
        this.emit('error', new SizeError(this.found, this.expect))
    }
    return super.emit(ev, ...data)
  }
}

MinipassSized.SizeError = SizeError

module.exports = MinipassSized

Youez - 2016 - github.com/yon3zu
LinuXploit