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

Bring back .load() possibly as a new npm module #210

Closed
BigBlueHat opened this issue Jul 16, 2018 · 3 comments
Closed

Bring back .load() possibly as a new npm module #210

BigBlueHat opened this issue Jul 16, 2018 · 3 comments

Comments

@BigBlueHat
Copy link

According to #163 the .load() API was removed to avoid filesystem related dependencies (which makes good sense)!

mime.load -> deleted (Relic of when node-mime straight from apache's mime.types file, introduced dependencies on path and fs that have been problematic as this module has moved into new spaces (Electron, react-native, etc)

However, that removal is causing some pain in https://github.com/jfhbrook/node-ecstatic and (relatedly) https://github.com/indexzero/http-server both of which have provided loading custom mime type databases from existing formats via this .load() feature.

Consequently, both projects are stuck with an earlier node-mime module until there's a path forward: either a new module for doing the loading or an optional feature here (or something).

Regardless, it'd be great to have this back in some form!

Thanks!
🎩

/cc @jfhbrook

@broofa
Copy link
Owner

broofa commented Jul 16, 2018

I'm afraid load() won't be coming back. I removed it not just because of the dependency issues mentioned previously (which are still valid concerns), but also because switching to mime-db meant there was no longer an internal need to load custom type files, especially in Apache's proprietary format.

If you want to create a separate module to load Apache .types it should be pretty straight-forward. Just copy/paste the .load() implementation , and format it into a structure suitable for passing to v2's mime.define().

@broofa broofa closed this as completed Jul 16, 2018
@jfhbrook
Copy link
Contributor

@BigBlueHat that works for me, if you want to be the all new maintainer of a apache mime.types loader package, it does look like it's relatively straightforward.

@jfhbrook
Copy link
Contributor

@broofa thanks for the direction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants