import { Api } from 'telegram' ; import { Snake } from '../../client' ; import { CustomFile } from 'telegram/client/uploads' ; import path from 'path' ; import fs from 'fs' ; import axios from 'axios' ; import FileType from 'file-type' ; export async function GetFileInfo ( file ) { if ( /^http/i . exec ( file ) ) { let res = await axios . get ( file , { responseType : 'arraybuffer' , } ) ; let basebuffer = Buffer . from ( res . data , 'utf-8' ) ; let fileInfo = await FileType . fromBuffer ( basebuffer ) ; return fileInfo ; } if ( /^(\/|\.\.?\/|~\/)/i . exec ( file ) ) { let fileInfo = await FileType . fromFile ( file ) ; return fileInfo ; } }