Skip to content

Commit 575d45d

Browse files
Add JimpMime constant (#1331)
1 parent 5be33f8 commit 575d45d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/docs/src/content/docs/guides/migrate-to-v1.mdx

+11-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,17 @@ const resized = await image
147147
## Removed Constants
148148

149149
- `Jimp.AUTO` - This constant was only needed for positional arguments. It is no longer needed with the new API.
150-
- `Jimp.MIME_*` - These are now part of the TS api when encoding
150+
151+
### `Jimp.MIME_*`
152+
153+
These have moved to a named export `JimpMime`.
154+
155+
```js
156+
import { JimpMime } from "jimp";
157+
158+
JimpMime.jpeg;
159+
```
160+
151161

152162
## Moved Functions
153163

packages/jimp/src/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ export const defaultPlugins = [
5454

5555
export const defaultFormats = [bmp, msBmp, gif, jpeg, png, tiff];
5656

57+
/** Convenience object for getting the MIME types of the default formats */
58+
export const JimpMime = {
59+
bmp: bmp().mime,
60+
gif: gif().mime,
61+
jpeg: jpeg().mime,
62+
png: png().mime,
63+
tiff: tiff().mime,
64+
};
65+
5766
// TODO: This doesn't document the constructor of the class
5867
/**
5968
* @class

0 commit comments

Comments
 (0)