Skip to content

Commit

Permalink
Add JimpMime constant (#1331)
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie authored Sep 7, 2024
1 parent 5be33f8 commit 575d45d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/docs/src/content/docs/guides/migrate-to-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,17 @@ const resized = await image
## Removed Constants

- `Jimp.AUTO` - This constant was only needed for positional arguments. It is no longer needed with the new API.
- `Jimp.MIME_*` - These are now part of the TS api when encoding

### `Jimp.MIME_*`

These have moved to a named export `JimpMime`.

```js
import { JimpMime } from "jimp";

JimpMime.jpeg;
```


## Moved Functions

Expand Down
9 changes: 9 additions & 0 deletions packages/jimp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ export const defaultPlugins = [

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

/** Convenience object for getting the MIME types of the default formats */
export const JimpMime = {
bmp: bmp().mime,
gif: gif().mime,
jpeg: jpeg().mime,
png: png().mime,
tiff: tiff().mime,
};

// TODO: This doesn't document the constructor of the class
/**
* @class
Expand Down

0 comments on commit 575d45d

Please sign in to comment.