HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/LC/node_modules/export-from-json/src/processors.ts
import type { ExportType } from './types.js'

export function generateDataURI (content: string, type: ExportType, byBlob: boolean): string {
  switch (type) {
    case 'txt': {
      const blobType = 'text/plain;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    case 'css': {
      const blobType = 'text/css;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    case 'html': {
      const blobType = 'text/html;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    case 'json': {
      const blobType = 'text/json;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    case 'csv': {
      const blobType = 'text/csv;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    case 'xls': {
      const blobType = 'text/application/vnd.ms-excel;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    case 'xml': {
      const blobType = 'text/application/xml;charset=utf-8'

      if (byBlob) return URL.createObjectURL(new Blob([content], { type: blobType }))

      return `data:,${blobType}` + encodeURIComponent(content)
    }
    default : {
      return ''
    }
  }
}

export function downloadFile (content: string, type: ExportType, fileName: string = 'download', byBlob = true): void {
  const dataURI = generateDataURI(content, type, byBlob)

  const anchor = document.createElement('a')
  anchor.href = dataURI

  anchor.download = fileName
  anchor.setAttribute('style', 'visibility:hidden')

  document.body.appendChild(anchor)
  anchor.dispatchEvent(
    new MouseEvent('click', {
      bubbles: false,
      cancelable: false,
      view: window,
    }),
  )
  document.body.removeChild(anchor)
}