Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@jimp/utils": "workspace:*",
"await-to-js": "^3.0.0",
"exif-parser": "^0.1.12",
"file-type": "^16.0.0",
"file-type": "^20.1.0",
"mime": "3"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Bitmap, Format, JimpClass, Edge } from "@jimp/types";
import { cssColorToHex, scan, scanIterator } from "@jimp/utils";
import fileType from "file-type/core.js";
import { to } from "await-to-js";
import { existsSync, readFile, writeFile } from "@jimp/file-ops";
import mime from "mime/lite.js";
Expand Down Expand Up @@ -334,7 +333,8 @@ export function createJimp<
const actualBuffer =
buffer instanceof ArrayBuffer ? bufferFromArrayBuffer(buffer) : buffer;

const mime = await fileType.fromBuffer(actualBuffer);
const { fileTypeFromBuffer } = await import("file-type/core");
const mime = await fileTypeFromBuffer(actualBuffer);

if (!mime || !mime.mime) {
throw new Error("Could not find MIME for Buffer");
Expand Down
138 changes: 86 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.