fileasy
v1.1.2
Published
![media](https://raw.githubusercontent.com/NAKAK10/fileasy/main/docs/public/media-dark.png)
Downloads
398
Maintainers
Readme
fileasy
documantation
conversion
const base64ToFile: (base64: string, fileName?: string, type?: string) => File
const binaryToString: (data: ArrayBuffer | File) => Promise<string>
const fileToArrayBuffer: (file: File) => Promise<ArrayBuffer>
const fileToBase64: (file: File) => Promise<string>
// path: base64 | dataDUI | URL
const fileToHTMLImageElement: (path: string) => Promise<HTMLImageElement>
const svgToJpeg: (svgData: string | File, name?: string, fillStyle?: string) => Promise<File>
const jpegToPng: (svgData: string | File, name?: string) => Promise<File>
const pngToJpeg: (svgData: string | File, name?: string, fillStyle?: string) => Promise<File>
const svgToPng: (svgData: string | File, name?: string) => Promise<File>
const pdfToPng: (pdfFile: File, pageNum?: number) => Promise<File[]>
const pngToHex: (buffer: Buffer) => Promise<PngToHex>
const videoToPng: (videoFile: File, currentTime?: number, secLimit?: number) => Promise<string>
Warning ↑ https://fileasy.rucuru.com/convert/pngToHex.html
get
const getInfoFromFile: (file: File) => Promise<GetInfoFromFile>
const getMimeTypeFromBuffer: (data: Buffer) => string
Warning ↑ https://fileasy.rucuru.com/get/getMimeTypeFromBuffer.html
const getDataFromByte: (size: number) => {formatNum: number; unit: string; full: string;}
const getTypeFromDataURI: (base64: string) => string
other
const downloadToDevice: (fileData?: GetInfoFromFile | File, name?: string) => void
function downloadFromURL(url: string, type: string, name: string, fun?: ((rogress: number) => void) | undefined): Promise<File>
const selectFile: (accept?: string, maxLen?: number) => Promise<File[] | undefined>
types
type GetInfoFromFile = {
file: File,
path: string,
type: string,
name: string,
size: number,
stringBytes: string,
width: number,
height: number,
base64: string,
extension: string,
}
export type GetInfoFromFile = {
file: File
path: string
type: string
name: string
size: number
stringBytes: string
width: number
height: number
base64: string
extension: string
}
type GetMimeTypeFromBuffer =
| 'image/png'
| 'image/jpeg'
| 'image/gif'
| 'image/tiff'
| 'image/webp'
| 'image/svg+xml'
| 'application/pdf'
| 'application/msword'
| 'video/mp4'
| 'audio/mpeg'
| 'application/octet-stream'
type PngToHex = {
width: number
height: number
depth: number
color: number
compress: number
filter: number
interlac: number
data: string[]
}