import type { DefineComponent, Plugin } from "vue"

export type ViewFileType =
  | "docx"
  | "xlsx"
  | "pdf"
  | "pptx"
  | "gif"
  | "jpg"
  | "jpeg"
  | "bmp"
  | "tiff"
  | "tif"
  | "png"
  | "svg"
  | "txt"
  | "json"
  | "js"
  | "css"
  | "java"
  | "py"
  | "html"
  | "jsx"
  | "ts"
  | "tsx"
  | "xml"
  | "md"
  | "log"
  | string

export interface ViewFileInput {
  filename?: string
  type?: ViewFileType
  fileBuffer?: ArrayBuffer | null
  size?: number
  name?: string
}

export const ViewFile: DefineComponent<{
  file?: ViewFileInput
}>

export function getExtend(name: string): string
export function readBuffer(file: File): Promise<ArrayBuffer>
export function readDataURL(buffer: ArrayBuffer): Promise<string>
export function readText(buffer: ArrayBuffer): Promise<string>
export function render(buffer: ArrayBuffer, type: string, target: HTMLElement): Promise<any>

declare const plugin: Plugin
export default plugin
