1- import fileType from 'file-type' ;
1+ import FileType from 'file-type' ;
22
33import EXIFParser from 'exif-parser' ;
44import { throwError } from '@jimp/utils' ;
@@ -7,8 +7,8 @@ import * as constants from '../constants';
77import * as MIME from './mime' ;
88import promisify from './promisify' ;
99
10- function getMIMEFromBuffer ( buffer , path ) {
11- const fileTypeFromBuffer = fileType ( buffer ) ;
10+ async function getMIMEFromBuffer ( buffer , path ) {
11+ const fileTypeFromBuffer = await FileType . fromBuffer ( buffer ) ;
1212
1313 if ( fileTypeFromBuffer ) {
1414 // If fileType returns something for buffer, then return the mime given
@@ -149,8 +149,8 @@ function exifRotate(img) {
149149}
150150
151151// parses a bitmap from the constructor to the JIMP bitmap property
152- export function parseBitmap ( data , path , cb ) {
153- const mime = getMIMEFromBuffer ( data , path ) ;
152+ export async function parseBitmap ( data , path , cb ) {
153+ const mime = await getMIMEFromBuffer ( data , path ) ;
154154
155155 if ( typeof mime !== 'string' ) {
156156 return cb ( new Error ( 'Could not find MIME for Buffer <' + path + '>' ) ) ;
0 commit comments