소스 검색

Change to use new FileType library

j433866 6 년 전
부모
커밋
bb7487c476
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      src/core/operations/ParseQRCode.mjs

+ 2 - 3
src/core/operations/ParseQRCode.mjs

@@ -6,7 +6,7 @@
 
 import Operation from "../Operation";
 import OperationError from "../errors/OperationError";
-import Magic from "../lib/Magic";
+import { isImage } from "../lib/FileType.mjs";
 import { parseQrCode } from "../lib/QRCode";
 
 /**
@@ -50,9 +50,8 @@ class ParseQRCode extends Operation {
      */
     async run(input, args) {
         const [normalise] = args;
-        const type = Magic.magicFileType(input);
 
-        if (!type || type.mime.indexOf("image") !== 0) {
+        if (!isImage(input)) {
             throw new OperationError("Invalid file type.");
         }
         return await parseQrCode(input, normalise);