Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JimpMime constant #1331

Merged
merged 1 commit into from
Sep 7, 2024
Merged
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
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
Loading