import getFileDetail from './getFileDetail' ; import createThumbnail from './createThumbnail' ; import { IFileDetail } from '../index' ; param file param quality param callback export default function handleFileInfo ( { file , quality } , callback ) { const { fileSize , fileType , isPic , fileName } = getFileDetail ( file ) ; const fileDetail = { file , fileType , fileSize , fileName , thumbnail : '' , } ; const callbackFunc = ( url ) => { fileDetail . thumbnail = url ; callback ( fileDetail ) ; } ; if ( isPic ) { createThumbnail ( { file , quality , fileType , } ) . then ( ( url ) => callbackFunc ( url ) ) . catch ( ( e ) => console . error ( e ) ) ; } else { callback ( fileDetail ) ; } }