hono icon indicating copy to clipboard operation
hono copied to clipboard

feat: expose built-in MIME types

Open cometkim opened this issue 1 year ago • 1 comments

This allows users reuse builtin MIME types while adding some custom.

import { baseMimes, getMimeType } from 'hono/utils/mime';

const mimes = {
  ...baseMimes,
  'my-own-ext': 'text/plain',
};

getMimeType('base.my-own-ext', mimes)

Author should do the followings, if applicable

  • [ ] Add tests
  • [ ] Run tests
  • [x] yarn denoify to generate files for Deno

cometkim avatar Apr 16 '24 09:04 cometkim

I recognize that it can be accessed indirectly by calling getMimeType twice, and it's way more performant than copying all values per each request.

However, copying once in advance is obviously 2x better than calling twice.

cometkim avatar Apr 16 '24 10:04 cometkim

Hi @cometkim !

Sorry to be late.

This sounds good. I've left a comment. Check it!

If this PR is OK, I'll merge this into the "next" branch for the next minor release.

yusukebe avatar Apr 30 '24 11:04 yusukebe

@cometkim

Thanks! Merging now.

yusukebe avatar Apr 30 '24 21:04 yusukebe